# Introduction

Authereum allows your dapp to have a seamless onboarding experience for your users.

## NOTICE: Authereum has closed down. See this [article](https://medium.com/authereum/an-end-and-a-new-beginning-ae0e2e596e1b) for more info.

## Features

* Fully non-custodial
* Contract-based accounts
* Easy integration

## Getting started

Get up and running with Authereum quickly with the getting started guide:

{% content-ref url="/pages/-M-Vv-ZzlAvOB-g3VZ4l" %}
[Getting started](/getting-started)
{% endcontent-ref %}

## Installation

Learn how to install Authereum with NPM or a CDN:

{% content-ref url="/pages/-Lu-H32i6MgjT4UqJvRB" %}
[Install](/install)
{% endcontent-ref %}

## Contribute

See the contributing guide:

{% content-ref url="/pages/-Lu-XM9hzeq1Y\_0J\_fu1" %}
[Contributing](/contributing)
{% endcontent-ref %}

## Try out Authereum

Try out dapps using Authereum:

{% content-ref url="/pages/-M5F\_Kj5\_jNnP4ma\_hXV" %}
[Dapps using Authereum](/dapps-using-authereum)
{% endcontent-ref %}

## Support

If you are having issues, please let us know. We have a telegram group located at: <https://t.me/authereum>


# Getting started

Get started with Authereum using a few lines of code

To get started, install the [authereum](http://npmjs.com/authereum) package from NPM:

```bash
npm install authereum 
```

Now instantiate Authereum with the desired network:

```javascript
import Authereum from 'authereum'

const authereum = new Authereum('kovan')
```

If you're used to using Web3.js for your dapp, Authereum can be a drop-in replacement web3 provider.

```javascript
import Authereum from 'authereum'
import Web3 from 'web3'

const authereum = new Authereum('kovan')

const provider = authereum.getProvider()
const web3 = new Web3(provider)

await provider.enable()

const accounts = await web3.eth.getAccounts()
console.log(accounts[0])
```

That's it!&#x20;

You can make web3 calls as you normally would. Take a look at more [web3 provider examples](/web3-provider).

{% content-ref url="/pages/-Lu-Yjsb12c254kb1gy\_" %}
[Web3 provider](/web3-provider)
{% endcontent-ref %}


# Live demos

⚠️ The demos are in beta

## Kitchen Sinks

* [Mainnet Kitchen Sink](https://demo.authereum.com)
* [Kovan Kitchen Sink](https://kovan.demo.authereum.com/)
* [Rinkeby Kitchen Sink](https://rinkeby.demo.authereum.com/)
* [Goerli Kitchen Sink](https://goerli.demo.authereum.com/)
* [Ropsten Kitchen Sink](https://ropsten.demo.authereum.com/)

## Uniswap Demos

* [Mainnet Uniswap](https://uniswap.authereum.com/)
* [Kovan Uniswap](https://uniswap.demo.authereum.com/)


# Dapps using Authereum

Dapps you can use with Authereum

## Dapps using Authereum

Apps that integrated Authereum either by [direct integration](/web3-provider#web3-provider), using [Web3Connect](https://web3connect.com/), or using [Onboard.js](https://docs.blocknative.com/onboard).

* [OpenSea](https://opensea.io/)&#x20;
* [Gnosis Safe](https://gnosis-safe.io)
* [Gitcoin](https://gitcoin.co/)
* [Kickback Events](https://kickback.events)
* [3Box](http://3box.io)
* [1inch Exchange](https://1inch.exchange/)
* [DEX.AG](https://dex.ag/)
* [DefiSnap](https://www.defisnap.io)
* [Yearn](https://yearn.finance/)
* [Totle](https://totle.com/)
* [ErasureBay](https://erasurebay.org/)
* [BeToken](https://betoken.fund)
* [Curve.fi](https://www.curve.fi)
* [88mph](https://88mph.app/)
* [MultiSender](https://multisender.app/)
* [Zapper.fi](https://www.zapper.fi/#/dashboard)
* [LRC Staking](https://staking.loopring.org)
* [ygov-finance](https://ygov.finance/)
* [Pools](https://pools.fyi/)
* [The Fund](https://app.rari.capital/)
* [Stake LID](https://stake.lid.sh/)
* [ERC20 Faucet](https://erc20faucet.com/)
* [Aave](https://app.aave.com/)
* [Omen](https://omen.eth.link/)
* [PoolTogether](https://app.pooltogether.com/)
* [yinsure](https://yinsure.finance/)
* [yieldfarming.insure](https://yieldfarming.insure/)
* [Hegic](https://www.hegic.co/)
* [Value Defi](https://valuedefi.io/)
* [Dego](https://dego.finance)
* [Itchiro](https://app.itchiro.com/)
* [Kwenta](https://kwenta.eth.link/)
* [SmartPiggies](https://www.smartpiggies.com/) (soon)
* [Tornado Cash](https://tornado.cash/) (soon)
* [Colony](https://colony.io/connect) (soon)
* [Uniswap](https://uniswap.exchange/) (soon)

#### Dapps you can use with WalletConnect

* [MyEtherWallet](https://www.myetherwallet.com/access-my-wallet)
* [Zerion](https://app.zerion.io/)
* [PoolTogether](https://app.pooltogether.com/)
* [Swap rate](https://swaprate.finance/)
* [DefiSaver](https://defisaver.com/)
* [Synthetix](https://synthetix.exchange/)&#x20;
* [Bamboo Relay](https://bamboorelay.com/)
* [Uniswap](https://uniswap.exchange/)
* [DDEX](https://ddex.io)&#x20;
* [dex.blue](https://dex.blue)
* [KyberSwap](https://kyberswap.com)
* [Loopring](https://loopring.io)
* [Mesa](https://mesa.eth.link)
* [dydx](https://trade.dydx.exchange)
* [Oasis](https://oasis.app)
* [LocalCryptos](https://localcryptos.com)
* [Binance Dex](https://www.binance.org/)
* [Hummingbot](https://miners.hummingbot.io/)
* [Aave](https://app.aave.com)
* [Sablier](https://pay.sablier.finance/)
* [StablePay](https://stablepay.io/dashboard)
* [Matcha](https://matcha.xyz/)
* [DefiPortfolio](https://portfolio.defiprime.com)
* [Rarible](https://app.rarible.com)
* [Gelato](https://play.gelato.finance/)
* [RCN](https://rcn.market)
* [Hegic](https://www.hegic.co/)
* [Mintbase](https://mintbase.io/)
* [Clovers](https://clovers.network/)
* [Mooni](https://app.mooni.tech)
* [DaoStack](https://alchemy.daostack.io/)
* [KnownOrigin](https://knownorigin.io)
* [Affogato](https://affogato.co/)
* [BulkSender](https://bulksender.app/)
* [HelioWallet](https://heliowallet.com/)
* [Swipe](https://app.swipe.org/)

Is your app not listed here? Let us know! message us on [Telegram](https://t.me/authereum).


# Install

## **Installing**

Install the [Authereum SDK](https://www.npmjs.com/package/authereum) package from NPM:

```bash
$ npm install authereum --save
```

Please note that Authereum is meant for browser applications. For node.js support, see [this FAQ](/faq).

## **Upgrading package**

Upgrade to the latest version using the `@latest` tag:

```bash
$ npm install authereum@latest --save
```

## CDN

The Authereum SDK library is available on the [jsDelivr CDN](https://cdn.jsdelivr.net/npm/authereum@latest/authereum.js):

```markup
<script src="https://cdn.jsdelivr.net/npm/authereum@latest/authereum.js"></script>
```

Note: to purge the jsdeliver cache, visit this [purge url](https://purge.jsdelivr.net/npm/authereum@latest/authereum.js).

Alternatively, it's also available on the [unpkg CDN](https://unpkg.com/authereum@latest/authereum.js):

```markup
<script src="https://unpkg.com/authereum@latest/authereum.js"></script>
```

Afterwards the window function `window.Authereum` will be available to instantiate Authereum.

## Importing

#### Using ES6 modules:

```javascript
import Authereum from 'authereum'
```

#### Using commonjs modules:

```javascript
const Authereum = require('authereum').default
```


# Integration

Integrating Authereum into your dapp is as easy as setting the Web3 provider. [See the web3 provider guide](/web3-provider).

## Integration guides

* [Web3 provider guide](/web3-provider)
* [Ethers.js Signer guide](/ethers-signer)
* [SDK guide](/sdk)

## Third party libraries

Authereum is integrated into the following 3rd party libraries:

* [Web3Modal](https://github.com/Web3Modal/web3modal)
* [Web3-React](https://github.com/NoahZinsmeister/web3-react/)
* [Blocknative Onboard](https://github.com/blocknative/onboard)
* [Dappkit (DappAuth)](https://github.com/dappkit/dappauth)
* [ENSLogin](https://github.com/enslogin/modules)
* [EAuth](https://github.com/pelith/node-eauth-server)
* [WalletConnect](https://github.com/WalletConnect/walletconnect-monorepo)

[Next ](https://authereum.readthedocs.io/en/latest/contributing.html)[ Previous](https://authereum.readthedocs.io/en/latest/usage.html)<br>

###


# Web3 provider

## **Web3 Provider**

Authereum is available as a Web3 provider.

Initialize the Authereum SDK and pass the provider to Web3:

```javascript
import Authereum from 'authereum'
import Web3 from 'web3'

const authereum = new Authereum('kovan')

const provider = authereum.getProvider()
const web3 = new Web3(provider)
```

**Alternatively**, the Authereum provider can be initialized directly.

```javascript
import { AuthereumProvider } from 'authereum'
import Web3 from 'web3'

const provider = new AuthereumProvider('kovan')
const web3 = new Web3(provider)
```

### **Switch Networks**

To switch networks, the provider will need to be reinitialized with the network name:

```javascript
import Authereum from 'authereum'
import Web3 from 'web3'

const networkName = 'rinkeby'
const authereum = new Authereum(networkName)

const provider = authereum.getProvider()
const web3 = new Web3(provider)
```

### **MetaMask and Web3 Browsers**

Use web3 injected provider is available or use Authereum's web3 provider:

```javascript
import Authereum from 'authereum'
import Web3 from 'web3'

let web3 

if (window.ethereum) {
    web3 = new Web3(window.ethereum)
} else if (window.web3) {
    web3 = new Web3(window.web3.currentProvider)
} else {
    const authereum = new Authereum('kovan')
    web3 = new Web3(authereum.getProvider())
}

const accounts = await web3.eth.getAccounts()
console.log(accounts[0])
```

### **Using Script Tags**

Using Web3 and Authereum libraries from CDNs and injecting web3 and the provider into the global window object:

```markup
<script src="https://cdn.jsdelivr.net/gh/ethereum/web3.js@1.0.0-beta.34/dist/web3.min.js"></script>
<script src="https://unpkg.com/authereum@latest/authereum.js"></script>
<script>
  const authereum = new Authereum('mainnet')
  const provider = authereum.getProvider()
  
  window.ethereum = provider
  window.web3 = new Web3(provider)
</script>
```

### **Provider Options**

See the[ Authereum SDK guide](/sdk) to see the options available.

## **Examples**

### **Logging in**

&#x20;Call the enable method on the provider to login:

```javascript
import Authereum from 'authereum'
import Web3 from 'web3'

const authereum = new Authereum('kovan')
const provider = authereum.getProvider()
const web3 = new Web3(provider)

await provider.enable()

// Alternatively
// await web3.currentProvider.enable()
```

### **Logging out**

&#x20;Call the disable method on the provider to logout:

```javascript
const authereum = new Authereum('kovan')
const provider = authereum.getProvider()
const web3 = new Web3(provider)

await provider.disable()

// Alternatively
// await web3.currentProvider.disable()
```

### **Is Connected**

Check if user is connected to dapp.

```javascript
const authereum = new Authereum('kovan')
const provider = authereum.getProvider()
const web3 = new Web3(provider)

const isConnected = provider.isConnected()

console.log(isConnected)
```

### **Get Accounts**

Get connected account address:

```javascript
import Authereum from 'authereum'
import Web3 from 'web3'

const authereum = new Authereum('kovan')
const web3 = new Web3(authereum.getProvider())

const accounts = await web3.eth.getAccounts()
console.log(accounts[0])

// Alternatively
// const account = await web3.eth.getCoinbase()
// console.log(account)
```

### **Get Balance**

&#x20;Reading the account ETH balance:

```javascript
import Authereum from 'authereum'
import Web3 from 'web3'

const authereum = new Authereum('kovan')
const web3 = new Web3(authereum.getProvider())

const accounts = await web3.eth.getAccounts()
const balance = await web3.eth.getBalance(accounts[0])
console.log(balance)
```

### Detecting Authereum web3 provider

Example of how to check if web3 provider is an Authereum provider:

```javascript
import Authereum from 'authereum'
import Web3 from 'web3'

const authereum = new Authereum('kovan')
const provider = authereum.getProvider()
const web3 = new Web3(provider)

console.log(provider.isAuthereum)

// Alternatively
// console.log(web3.currentProvider.isAuthereum)
```

### Sign Message

Example of how to sign a message:

```javascript
import Authereum from 'authereum'

const authereum = new Authereum('kovan')
const provider = authereum.getProvider()
  
const account = (await provider.getAccounts())[0]
const message = 'hello world'
const signature = await web3.eth.sign(message, account)
console.log(signature)
```

### Sign Personal Message

Example of how to sign a personal message:

```javascript
import Authereum from 'authereum'

const authereum = new Authereum('kovan')
const provider = authereum.getProvider()
  
const account = (await provider.getAccounts())[0]
const message = 'hello world'
const signature = await web3.eth.personal.sign(message, account)
console.log(signature)
```

### Sign Typed Data

Example of how to sign typed data using [EIP-712](https://github.com/ethereum/EIPs/blob/master/EIPS/eip-712.md):

```javascript
import Authereum from 'authereum'

const authereum = new Authereum('kovan')
const provider = authereum.getProvider()
  
const from = (await provider.getAccounts())[0]
const payload = [
   {
     type: 'string',
     name: 'username',
     value: 'alice'
   },
   {
     type: 'uint32',
     name: 'userId',
     value: '12345'
   }
 ]


const params = [payload, from]
const method = 'eth_signTypedData'

provider.sendAsync({
  id: 1,
  method,
  params,
  from
}, (error, res) => {
  if (error) throw error
  console.log(res.result)
})
```

### Sign Transaction

Example of how to sign a transaction:

```javascript
import Authereum from 'authereum'
import Web3 from 'web3'

const authereum = new Authereum('mainnet')
const provider = authereum.getProvider()
const web3 = new Web3(provider)

const tx = {
  to: '0x22d491Bde2303f2f43325b2108D26f1eAbA1e32b',
  value: '10000000000000000'
}

const { raw } = await web3.eth.signTransaction(tx)
const transactionHash = web3.utils.sha3(raw)

console.log(transactionHash)
```

### Send Transaction

Example of how to send a transaction:

```javascript
import Authereum from 'authereum'
import Web3 from 'web3'

const authereum = new Authereum('mainnet')
const provider = authereum.getProvider()
const web3 = new Web3(provider)

const tx = {
  to: '0x22d491Bde2303f2f43325b2108D26f1eAbA1e32b',
  value: '10000000000000000'
}

const { transactionHash } = await web3.eth.sendTransaction(tx)

console.log(transactionHash)
```

### Send Transaction Batch

Example of how to send a transaction batch (2 ETH transfers):

```javascript
import Authereum from 'authereum'
import Web3 from 'web3'

const authereum = new Authereum('mainnet')
const provider = authereum.getProvider()
const web3 = new Web3(provider)

const txs = [
  {
    to: '0x22d491Bde2303f2f43325b2108D26f1eAbA1e32b',
    value: '10000000000000000',
    gasLimit: '1000000'
  }, {
    to: '0x22d491Bde2303f2f43325b2108D26f1eAbA1e32b',
    value: '10000000000000000',
    gasLimit: '1000000'
  }
]

const { transactionHash } = await provider.sendTransactionBatch(txs)

console.log(transactionHash)
```

Example of how to send a transaction batch (DAI approve and transferFrom):

```javascript
import Authereum from 'authereum'
import Web3 from 'web3'

const authereum = new Authereum('mainnet')
const provider = authereum.getProvider()
const web3 = new Web3(provider)

const txs = [
  // Approve
  {
    to: '0x6B175474E89094C44Da98b954EedeAC495271d0F',
    value: '0',
    gasLimit: '1000000',
    data: '0x095ea7b3000000000000000000000000e4c9194962532feb467dce8b3d42419641c6ed2e0000000000000000000000000000000000000000000000008c4cb6a94641cfbd'
  },
  // transferFrom
  {
    to: '0x6B175474E89094C44Da98b954EedeAC495271d0F',
    value: '0',
    gasLimit: '1000000',
    data: '0x23b872dd0000000000000000000000003b18c73ed8ff086695b6b9b314843dfde9fad1c600000000000000000000000018d3d5d945353f46f0f5ca7b808c8a6443e6cbb40000000000000000000000000000000000000000000000008c4cb6a94641cfbd'
  }
]

const { transactionHash } = await provider.sendTransactionBatch(txs)

console.log(transactionHash)
```

### Estimate Gas Batch

Example of how to estimate a transaction batch (2 ETH transfers):

```javascript
import Authereum from 'authereum'
import Web3 from 'web3'

const authereum = new Authereum('mainnet')
const provider = authereum.getProvider()
const web3 = new Web3(provider)

const txs = [
  {
    to: '0x22d491Bde2303f2f43325b2108D26f1eAbA1e32b',
    value: '10000000000000000'
  }, {
    to: '0x22d491Bde2303f2f43325b2108D26f1eAbA1e32b',
    value: '10000000000000000'
  }
]

const { transactionHash } = await provider.estimateGasBatch(txs)

console.log(transactionHash) // [17894, 11845]
```

Example of how to estimate a transaction batch (DAI approve and transferFrom):

```javascript
import Authereum from 'authereum'
import Web3 from 'web3'

const authereum = new Authereum('mainnet')
const provider = authereum.getProvider()
const web3 = new Web3(provider)

const txs = [
  // Approve
  {
    to: '0x6B175474E89094C44Da98b954EedeAC495271d0F',
    value: '0',
    data: '0x095ea7b3000000000000000000000000e4c9194962532feb467dce8b3d42419641c6ed2e0000000000000000000000000000000000000000000000008c4cb6a94641cfbd'
  },
  // transferFrom
  {
    to: '0x6B175474E89094C44Da98b954EedeAC495271d0F',
    value: '0',
    data: '0x23b872dd0000000000000000000000003b18c73ed8ff086695b6b9b314843dfde9fad1c600000000000000000000000018d3d5d945353f46f0f5ca7b808c8a6443e6cbb40000000000000000000000000000000000000000000000008c4cb6a94641cfbd'
  }
]

const { transactionHash } = await provider.estimateGasBatch(txs)

console.log(transactionHash) // [10955,7057]
```

### ERC20: Token Balance

Example of how to read token balance:

```javascript
import Authereum from 'authereum'
import Web3 from 'web3'

const authereum = new Authereum('mainnet')
const provider = authereum.getProvider()
const web3 = new Web3(provider)

const abi = [{
    "constant": true,
    "inputs": [
        {
            "name": "_owner",
            "type": "address"
        }
    ],
    "name": "balanceOf",
    "outputs": [
        {
            "name": "balance",
            "type": "uint256"
        }
    ],
    "payable": false,
    "stateMutability": "view",
    "type": "function"
}]

const token = '0x89d24a6b4ccb1b6faa2625fe562bdd9a23260359'
const instance = await new web3.eth.Contract(abi, token)

const account = '0x22d491Bde2303f2f43325b2108D26f1eAbA1e32b'
const amount = await instance.methods.balanceOf(account).call()

console.log(amount)
```

### ERC20: Token Allowance

Example of how to read token allowance:

```javascript
import Authereum from 'authereum'
import Web3 from 'web3'

const authereum = new Authereum('mainnet')
const provider = authereum.getProvider()
const web3 = new Web3(provider)

const abi = [{
    "constant": true,
    "inputs": [
        {
            "name": "_owner",
            "type": "address"
        },
        {
            "name": "_spender",
            "type": "address"
        }
    ],
    "name": "allowance",
    "outputs": [
        {
            "name": "",
            "type": "uint256"
        }
    ],
    "payable": false,
    "stateMutability": "view",
    "type": "function"
}]

const token = '0x89d24a6b4ccb1b6faa2625fe562bdd9a23260359'
const instance = await new web3.eth.Contract(abi, token)

const owner = (await web3.eth.getAccounts())[0]
const spender = '0x22d491Bde2303f2f43325b2108D26f1eAbA1e32b'
const allowance = await instance.methods.allowance(owner, spender).call()

console.log(allowance)
```

### ERC20: Token Approve

Example of how to do a token approve call:

```javascript
import Authereum from 'authereum'
import Web3 from 'web3'

const authereum = new Authereum('mainnet')
const provider = authereum.getProvider()
const web3 = new Web3(provider)

const abi = [{
    "constant": false,
    "inputs": [
        {
            "name": "_spender",
            "type": "address"
        },
        {
            "name": "_value",
            "type": "uint256"
        }
    ],
    "name": "approve",
    "outputs": [
        {
            "name": "",
            "type": "bool"
        }
    ],
    "payable": false,
    "stateMutability": "nonpayable",
    "type": "function"
}]

const token = '0x89d24a6b4ccb1b6faa2625fe562bdd9a23260359'
const instance = await new web3.eth.Contract(abi, token)

const from = (await web3.eth.getAccounts())[0]
const spender = '0x22d491Bde2303f2f43325b2108D26f1eAbA1e32b'
const value = '1000000000000000000'
const { transactionHash } = await instance.methods.approve(spender, value).send({ from })

console.log(transactionHash)
```

### ERC20: Token Transfer

Example of how to do a token transfer call:

```javascript
import Authereum from 'authereum'
import Web3 from 'web3'

const authereum = new Authereum('mainnet')
const provider = authereum.getProvider()
const web3 = new Web3(provider)

const abi = [{
    "constant": false,
    "inputs": [
        {
            "name": "_to",
            "type": "address"
        },
        {
            "name": "_value",
            "type": "uint256"
        }
    ],
    "name": "transfer",
    "outputs": [
        {
            "name": "",
            "type": "bool"
        }
    ],
    "payable": false,
    "stateMutability": "nonpayable",
    "type": "function"
}]

const token = '0x89d24a6b4ccb1b6faa2625fe562bdd9a23260359'
const instance = await new web3.eth.Contract(abi, token)

const from = (await web3.eth.getAccounts())[0]
const to = '0x22d491Bde2303f2f43325b2108D26f1eAbA1e32b'
const value = '1000000000000000000'
const { transactionHash } = await instance.methods.transfer(to, value).send({ from })

console.log(transactionHash)
```

### ERC20: Token Transfer From

Example of how to do a token transfer from call:

```javascript
import Authereum from 'authereum'
import Web3 from 'web3'

const authereum = new Authereum('mainnet')
const provider = authereum.getProvider()
const web3 = new Web3(provider)

const abi = [{
    "constant": false,
    "inputs": [
        {
            "name": "_from",
            "type": "address"
        },
        {
            "name": "_to",
            "type": "address"
        },
        {
            "name": "_value",
            "type": "uint256"
        }
    ],
    "name": "transferFrom",
    "outputs": [
        {
            "name": "",
            "type": "bool"
        }
    ],
    "payable": false,
    "stateMutability": "nonpayable",
    "type": "function"
}]

const token = '0x89d24a6b4ccb1b6faa2625fe562bdd9a23260359'
const instance = await new web3.eth.Contract(abi, token)

const from = (await web3.eth.getAccounts())[0]
const to = '0x22d491Bde2303f2f43325b2108D26f1eAbA1e32b'
const value = '1000000000000000000'
const { transactionHash } = await instance.methods.transferFrom(from, to, value).send({ from })

console.log(transactionHash)
```

### ERC721: Owner Of

Example of how to check owner of NFT:

```javascript
import Authereum from 'authereum'
import Web3 from 'web3'

const authereum = new Authereum('mainnet')
const provider = authereum.getProvider()
const web3 = new Web3(provider)

const abi = [{
    "constant": true,
    "inputs": [
        {
            "name": "tokenId",
            "type": "uint256"
        }
    ],
    "name": "ownerOf",
    "outputs": [
        {
            "name": "",
            "type": "address"
        }
    ],
    "payable": false,
    "stateMutability": "view",
    "type": "function"
}]

const token = '0x6EbeAf8e8E946F0716E6533A6f2cefc83f60e8Ab'
const instance = await new web3.eth.Contract(abi, token)

const tokenId = '580767'
const owner = await instance.methods.ownerOf(tokenId).call()

console.log(owner)
```

### ERC721: Get Approved

Example of how to check if NFT is approved:

```javascript
import Authereum from 'authereum'
import Web3 from 'web3'

const authereum = new Authereum('mainnet')
const provider = authereum.getProvider()
const web3 = new Web3(provider)

const abi = [{
    "constant": true,
    "inputs": [
        {
            "name": "tokenId",
            "type": "uint256"
        }
    ],
    "name": "getApproved",
    "outputs": [
        {
            "name": "",
            "type": "address"
        }
    ],
    "payable": false,
    "stateMutability": "view",
    "type": "function"
}]

const token = '0x6EbeAf8e8E946F0716E6533A6f2cefc83f60e8Ab'
const instance = await new web3.eth.Contract(abi, token)

const tokenId = '580767'
const to = await instance.methods.getApproved(tokenId).call()

console.log(to)
```

### ERC721: Approve

Example of how to do a NFT approve call:

```javascript
import Authereum from 'authereum'
import Web3 from 'web3'

const authereum = new Authereum('mainnet')
const provider = authereum.getProvider()
const web3 = new Web3(provider)

const abi = [{
    "constant": false,
    "inputs": [
        {
            "name": "to",
            "type": "address"
        },
        {
            "name": "tokenId",
            "type": "uint256"
        }
    ],
    "name": "approve",
    "outputs": [],
    "payable": false,
    "stateMutability": "nonpayable",
    "type": "function"
}]

const token = '0x06012c8cf97bead5deae237070f9587f8e7a266d'
const instance = await new web3.eth.Contract(abi, token)

const from = (await web3.eth.getAccounts())[0]
const to = '0x6EbeAf8e8E946F0716E6533A6f2cefc83f60e8Ab'
const tokenId = '580767'
const { transactionHash } = await instance.methods.approve(to, tokenId).send({ from })

console.log(transactionHash)
```

### ERC721: Transfer

Example of how to do a NFT transfer call:

```javascript
import Authereum from 'authereum'
import Web3 from 'web3'

const authereum = new Authereum('mainnet')
const provider = authereum.getProvider()
const web3 = new Web3(provider)

const abi = [{
  "constant": false,
  "inputs": [
    {
      "name": "to",
      "type": "address"
    },
    {
      "name": "tokenId",
      "type": "uint256"
    }
  ],
  "name": "transfer",
  "outputs": [],
  "payable": false,
  "stateMutability": "nonpayable",
  "type": "function"
}]

const token = '0x06012c8cf97bead5deae237070f9587f8e7a266d'
const instance = await new web3.eth.Contract(abi, token)

const from = (await web3.eth.getAccounts())[0]
const to = '0x22d491Bde2303f2f43325b2108D26f1eAbA1e32b'
const tokenId = '1667849'
const { transactionHash } = await instance.methods.transfer(from, to, tokenId).send({ from })

console.log(transactionHash)
```

### ERC721: Transfer From

Example of how to do a NFT transfer from call:

```javascript
import Authereum from 'authereum'
import Web3 from 'web3'

const authereum = new Authereum('mainnet')
const provider = authereum.getProvider()
const web3 = new Web3(provider)

const abi = [{
    "constant": false,
    "inputs": [
        {
            "name": "from",
            "type": "address"
        },
        {
            "name": "to",
            "type": "address"
        },
        {
            "name": "tokenId",
            "type": "uint256"
        }
    ],
    "name": "transferFrom",
    "outputs": [],
    "payable": false,
    "stateMutability": "nonpayable",
    "type": "function"
}]

const token = '0x6EbeAf8e8E946F0716E6533A6f2cefc83f60e8Ab'
const instance = await new web3.eth.Contract(abi, token)

const from = (await web3.eth.getAccounts())[0]
const to = '0x22d491Bde2303f2f43325b2108D26f1eAbA1e32b'
const tokenId = '580767'
const { transactionHash } = await instance.methods.transferFrom(from, to, tokenId).send({ from })

console.log(transactionHash)
```

### ERC721: Safe Transfer From

Example of how to do a NFT safe transfer from call:

```javascript
import Authereum from 'authereum'
import Web3 from 'web3'

const authereum = new Authereum('mainnet')
const provider = authereum.getProvider()
const web3 = new Web3(provider)

const abi = [{
    "constant": false,
    "inputs": [
        {
            "name": "from",
            "type": "address"
        },
        {
            "name": "to",
            "type": "address"
        },
        {
            "name": "tokenId",
            "type": "uint256"
        }
    ],
    "name": "transferFrom",
    "outputs": [],
    "payable": false,
    "stateMutability": "nonpayable",
    "type": "function"
}]

const token = '0x6EbeAf8e8E946F0716E6533A6f2cefc83f60e8Ab'
const instance = await new web3.eth.Contract(abi, token)

const from = (await web3.eth.getAccounts())[0]
const to = '0x22d491Bde2303f2f43325b2108D26f1eAbA1e32b'
const tokenId = '580767'
const data = '0x00'
const { transactionHash } = await instance.methods.safeTransferFrom(from, to, tokenId, data).send({ from })

console.log(transactionHash)
```

### Validating Signatures (ecrecover)

See the [Verifying Signatures](/verifying-signatures) page.


# Ethers Signer

## Ethers Signer

Example showing how to instantiate the [Ethers.js Signer](https://docs.ethers.io/ethers.js/html/api-wallet.html):

```javascript
import { AuthereumSigner } from 'authereum'

const signer = new AuthereumSigner('kovan')
```

## Examples

### **Sending transaction**

Example showing how to send a transaction using the ethers signer:

```javascript
import { AuthereumSigner } from 'authereum'

const signer = new AuthereumSigner('kovan')

const tx = {
  gasPrice: '0x2540be400',
  gasLimit: '0x186a0',
  to: '0x90f8bf6a479f320ead074411a4b0e7944ea8c9c1',
  value: '0x00',
  data: '0x'
}

const result = await signer.sendTransaction(tx)
console.log(result.hash)
```


# StarkWare Provider

⚠️ The StarkWare provider is in alpha

Heads up! The StarkWare provider is currently only available for **Ropsten** testnet and not feature complete yet.

## Getting started

Install `authereum@next` version:

```bash
npm install authereum@next
```

Instantiate the Authereum SDK and get StarkWare provider:

```javascript
import Authereum from 'authereum'

const authereum = new Authereum('ropsten')
await authereum.login()

const starkProvider = authereum.getStarkProvider()
const starkKey = await starkProvider.getStarkKey()
console.log(starkKey)
```

## Methods

These are the methods available under the Authereum StarkWare provider:

### `getStarkKey():Promise<string>`

> Returns the Stark key.

**Arguments:**&#x20;

*none*

**Returns:**

`Promise<string>`: Returns a promise with stark key string.

**Example:**

```javascript
const starkKey = await starkProvider.getStarkKey()
```

### `getPublicKey():Promise<string>`

> Returns the Stark public key.

**Arguments:**&#x20;

*none*

**Returns:**

`Promise<string>`: Returns a promise with stark public key string.

**Example:**

```javascript
const starkPublicKey = await starkProvider.getPublicKey()
```

### `setContractAddress(contractAddress):Promise<void>`

Sets the StarkEx contract address to use for the provider.

**Arguments:**&#x20;

| Value             | Type   | Definition               |
| ----------------- | ------ | ------------------------ |
| `contractAddress` | String | StarkEx contract address |

**Returns:**

`Promise<void>`

**Example:**

```javascript
await starkProvider.setContractAddress('0x5FedCE831BD3Bdb71F938EC26f984c84f40dB477')
```

### `getContractAddress():Promise<string>`

> Returns the StarkEx contract address.

**Arguments:**&#x20;

*none*

**Returns:**

`Promise<string>` : Returns a promise with contract address.

**Example:**

```javascript
const address = await starkProvider.getContractAddress()
```

### `registerUser(ethKey, operatorSignature):Promise<string>`

> Submits a transaction to register the Stark key.

**Arguments:**&#x20;

| Value               | Type   | Definition                                   |
| ------------------- | ------ | -------------------------------------------- |
| `ethKey`            | String | Ethereum EOA and account contract address    |
| `operatorSignature` | String | Operator signature required for registration |

**Returns:**

`Promise<string>:` Returns a promise with transaction hash.

**Example:**

```javascript
const ethKey = '0x22d491Bde2303f2f43325b2108D26f1eAbA1e32b'
const operatorSignature = '0xae50f29764c96ff5d1554f1d0605bdb992a62700eb8a0b2ffd711da6d6fd90781dbfbb8918c98c15e9fd6251ad89d55e30c20060cf300b51929129726718b6711c'
const txHash = await starkProvider.registerUser(ethKey, operatorSignature)
```

### `depositEth(vaultId, amount, quantum):Promise<string>`

> Submits a transaction to deposit ETH to vault.

**Arguments:**&#x20;

| Value     | Type   | Definition                                             |
| --------- | ------ | ------------------------------------------------------ |
| `vaultId` | String | Vault ID (e.g. `15`)                                   |
| `amount`  | String | ETH amount to deposit in wei (e.g. `1000000000000000`) |
| `quantum` | String | Quantum value (e.g. `10`)                              |

**Returns:**

`Promise<string>:` Returns a promise with transaction hash.

**Example:**

```javascript
const vaultId = '10'
const amount = '1000000000000000' // wei
const quantum = '10'
const txHash = await starkProvider.depositEth(vaultId, amount, quantum)
```

### `depositErc20(vaultId, amount, quantum, token):Promise<string>`

> Submits a transaction to deposit ERC20 token to vault.

**Arguments:**&#x20;

| Value     | Type   | Definition                                                                                                                              |
| --------- | ------ | --------------------------------------------------------------------------------------------------------------------------------------- |
| `vaultId` | String | Vault ID (e.g. `15`)                                                                                                                    |
| `amount`  | String | <p>Token amount to deposit</p><p>(e.g. if decimals is <code>6</code>, to deposit <code>0.42</code> it would be <code>420000</code>)</p> |
| `quantum` | String | Quantum value (e.g. `1000`)                                                                                                             |
| `token`   | String | Token contract address                                                                                                                  |

**Returns:**

`Promise<>:` Returns a promise with transaction hash.

**Example:**

```javascript
const vaultId = '10'
const amount = '420000' 
const quantum = '1000'
const token = '0x0d9c8723b343a8368bebe0b5e89273ff8d712e3c'
const txHash = await starkProvider.depositErc20(vaultId, amount, quantum, token)
```

### `depositErc721(vaultId, tokenId, token):Promise<string>`

> Submits a transaction to deposit ERC721 NFT to vault.

**Arguments:**&#x20;

| Value     | Definition            |
| --------- | --------------------- |
| `vaultId` | Vault ID (e.g. `15`)  |
| `tokenId` | Token ID (e.g. `452`) |
| `token`   | NFT contract address  |

**Returns:**

`Promise<string>:` Returns a promise with transaction hash.

**Example:**

```javascript
const vaultId = '10'
const tokenId = '1234'
const token = '0x6B5E013ba22F08ED46d33Fa6d483Fd60e001262e'
const txHash = await starkProvider.depositErc721(vaultId, tokenId, token)
```

### `cancelDeposit(vaultId, assetType):Promise<string>`

> Submits transaction to cancel deposit.

**Arguments:**&#x20;

| Value       | Type   | Definition           |
| ----------- | ------ | -------------------- |
| `assetType` | String | Asset type hash      |
| `vauldId`   | String | Vault ID (e.g. `15`) |

**Returns:**

`Promise<string>:` Returns a promise with transaction hash.

**Example:**

```javascript
const vaultId = '10'
const assetType = '0x4b744eda38322858d42ba43046badd5bd91e94844c0b7c47a4975d8b5b77b5'
const txHash = await starkProvider.cancelDeposit(vaultId, assetType)
```

### `reclaimDeposit(vaultId, assetType):Promise<string>`

> Submits transaction to reclaim deposit after cancelling deposit.

**Arguments:**&#x20;

| Value       | Type   | Definition           |
| ----------- | ------ | -------------------- |
| `assetType` | String | Asset type hash      |
| `vaultId`   | String | Vault ID (e.g. `15`) |

**Returns:**

`Promise<string>:` Returns a promise with transaction hash.

**Example:**

```javascript
const vaultId = '10'
const assetType = '0x4b744eda38322858d42ba43046badd5bd91e94844c0b7c47a4975d8b5b77b5'
const txHash = await starkProvider.relcaimDeposit(vaultId, assetType)
```

### `withdrawEth(quantum, recipient?):Promise<string>`

Submits transaction to withdraw ETH from vault.

**Arguments:**&#x20;

| Value       | Type   | Definition                   |
| ----------- | ------ | ---------------------------- |
| `quantum`   | String | Quantum value (e.g. `10`)    |
| `recipient` | String | (Optional) Recipient address |

**Returns:**

`Promise<string>:` Returns a promise with transaction hash.

**Example:**

```javascript
const vaultId = '10'
const recipient = '0x22d491Bde2303f2f43325b2108D26f1eAbA1e32b'
const txHash = await starkProvider.withdrawEth(quantum, recipient)
```

### `withdrawErc20(quantum, token, recipient?):Promise<string>`

Submits transaction to withdraw ERC20 token from vault.

**Arguments:**&#x20;

| Value       | Type   | Definition                   |
| ----------- | ------ | ---------------------------- |
| `quantum`   | String | Quantum value (e.g. `1000`)  |
| `token`     | String | Token contract address       |
| `recipient` | String | (Optional) Recipient address |

**Returns:**

`Promise<string>:` Returns a promise with transaction hash.

**Example:**

```javascript
const quantum = '1000'
const token = '0x0d9c8723b343a8368bebe0b5e89273ff8d712e3c'
const recipient = '0x22d491Bde2303f2f43325b2108D26f1eAbA1e32b'
const txHash = await starkProvider.withdrawErc20(quantum, token, recipient)
```

### `withdrawErc721(tokenId, token, recipient?):Promise<string>`

Submits transaction to withdraw ERC721 NFT from vault.

**Arguments:**&#x20;

| Value       | Type   | Definition                   |
| ----------- | ------ | ---------------------------- |
| `tokenId`   | String | Quantum value (e.g. `1000`)  |
| `token`     | String | Token ID (e.g. `452`)        |
| `recipient` | String | (Optional) Recipient address |

**Returns:**

`Promise<string>:` Returns a promise with transaction hash.

**Example:**

```javascript
const tokenId = '1234'
const token = '0x0d9c8723b343a8368bebe0b5e89273ff8d712e3c'
const recipient = '0x22d491Bde2303f2f43325b2108D26f1eAbA1e32b'
const txHash = await starkProvider.withdrawErc721(tokenId, token, recipient)
```

### `fullWithdrawalRequest(vaultId):Promise<string>`

> Submits transaction to do a request to withdraw all tokens from vault.

**Arguments:**&#x20;

| Value     | Type   | Definition           |
| --------- | ------ | -------------------- |
| `vaultId` | String | Vault ID (e.g. `15`) |

**Returns:**

`Promise<string>:` Returns a promise with transaction hash.

**Example:**

```javascript
const vaultId = '10'
const txHash = await starkProvider.fullWithdrawalRequest(vaultId)
```

### `freezeRequest(vaultId):Promise<string>`

> Submits transaction to freeze vault.

**Arguments:**&#x20;

| Value     | Type   | Definition           |
| --------- | ------ | -------------------- |
| `vaultId` | String | Vault ID (e.g. `15`) |

**Returns:**

`Promise<string>:` Returns a promise with transaction hash.

**Example:**

```javascript
const vaultId = '10'
const txHash = await starkProvider.freezeRequest(vaultId)
```

### `escape(vaultId, assetType, quantizedAmount):Promise<string>`

> Submits transaction to request escape from frozen contract.

**Arguments:**&#x20;

| Value             | Type   | Definition                                 |
| ----------------- | ------ | ------------------------------------------ |
| `vaultId`         | String | Vault ID (e.g. `15`)                       |
| `assetType`       | String | Asset type hash                            |
| `quantizedAmount` | String | Quantized amount (e.g. `amount / quantum`) |

**Returns:**

`Promise<string>:` Returns a promise with object containing transaction hash.

**Example:**

```javascript
const vaultId = '10'
const assetType = '0x4b744eda38322858d42ba43046badd5bd91e94844c0b7c47a4975d8b5b77b5'
const quantizedAmount = '8233298795789816600'
const txHash = await starkProvider.escape(vaultId, assetType, quantizedAmount)
```

### `transfer({object}):Promise<string>`

> Transfer ETH, ERC20, or ERC721 to a stark account. Returns signature.

**Arguments:** &#x20;

Object parameters:

| Value                        | Type           | Definition                                                                      |
| ---------------------------- | -------------- | ------------------------------------------------------------------------------- |
| `from`                       | TransferParams | Transfer sender params.                                                         |
| `to`                         | TransferParams | Transfer recipient params.                                                      |
| `asset`                      | Asset          | Asset to transfer                                                               |
| `amount`                     | String         | Amount                                                                          |
| `nonce`                      | String         | Nonce                                                                           |
| `expirationTimestamp`        | String         | Expiration timestamp                                                            |
| `condition`                  | String         | (optional) Condition hash (encoded hash of transfer address and fact)           |
| `conditionalTransferAddress` | String         | (optional) Conditional transfer address (not needed if `condition` hash is set) |
| `conditionalTransferFact`    | String         | (optional) Condition transfer fact  (not needed if `condition` hash is set)     |

**`Asset`**

| Value  | Type      | Definition                                     |
| ------ | --------- | ---------------------------------------------- |
| `type` | String    | Asset standard (e.g. `ETH`, `ERC20`, `ERC721)` |
| `data` | AssetData | Asset data object                              |

**`AssetData`**

| Value          | Type   | Definition                                                   |
| -------------- | ------ | ------------------------------------------------------------ |
| `quantum`      | String | Quantum value. Required if asset type is `ETH` or `ERC20`    |
| `tokenAddress` | String | Token address. Required if asset type is `ERC20` or `ERC721` |
| `tokenId`      | String | Token ID. Required if asset type is `ERC721`                 |

**`TransferParams`**

| Value      | Type   | Definition |
| ---------- | ------ | ---------- |
| `vaultId`  | String | Vault ID   |
| `starkKey` | String | Stark key. |

**Returns:**

`Promise<string>:` Returns a promise with transfer stark signature.

**Example:**

```javascript
const starkSignature = await starkProvider.transfer({
    from: {
        vaultId: '10',
    },
    to: {
        vaultId: '15',
        starkKey: '0x04887f4c82218a6d13c6a0a249413e6e53b6910de5f0e6b5d85cfef1db04553b',
    },
    asset: {
        type: 'ETH',
        data: {
            quantum: '1000'
        }
    },
    amount: '1',
    nonce: '2433',
    expirationTimestamp: '1605826942',
    condition: null,
})
```

### `transferEth({object}):Promise<string>`

> Transfer ETH to a stark account. Returns signature.

**Arguments:**&#x20;

Object parameters:

| Value                 | Type   | Definition                |
| --------------------- | ------ | ------------------------- |
| `senderVaultId`       | String | Sender vault ID           |
| `receiverVaultId`     | String | Receiver vault ID         |
| `receiverKey`         | String | Receiver stark key        |
| `nonce`               | String | Nonce                     |
| `expirationTimestamp` | String | Expiration timestamp      |
| `condition`           | String | Conditional transfer hash |
| `quantum`             | String | Quantum value             |
| `amount`              | String | Amount                    |

**Returns:**

`Promise<string>:` Returns a promise with transfer stark signature.

**Example:**

```javascript
const starkSignature = await starkProvider.depositEth({
    senderVaultId: '10',
    receiverVaultId: '15',
    receiverKey: '0x04887f4c82218a6d13c6a0a249413e6e53b6910de5f0e6b5d85cfef1db04553b',
    nonce: '2433',
    expirationTimestamp: '1605826942',
    condition: null,
    quantum: '10',
    amount: '1'
})
```

### `transferErc20({object}):Promise<string>`

> Transfer ERC20 token to a stark account. Returns signature.

**Arguments:**&#x20;

Object parameters:

| Value                  | Type   | Definition                |
| ---------------------- | ------ | ------------------------- |
| `senderVaultId`        | String | Sender vault ID           |
| `receiverVaultId`      | String | Receiver vault ID         |
| `receiverKey`          | String | Receiver stark key        |
| `nonce`                | String | Nonce                     |
| `expirationTimestamp`  | String | Expiration timestamp      |
| `condition`            | String | Conditional transfer hash |
| `assetContractAddress` | String | ERC20 contract address    |
| `quantum`              | String | Quantum value             |
| `amount`               | String | Amount                    |

**Returns:**

`Promise<string>:` Returns a promise with transfer stark signature.

**Example:**

```javascript
const starkSignature = await starkProvider.depositErc20({
    senderVaultId: '10',
    receiverVaultId: '15',
    receiverKey: '0x04887f4c82218a6d13c6a0a249413e6e53b6910de5f0e6b5d85cfef1db04553b',
    nonce: '2433',
    expirationTimestamp: '1605826942',
    condition: null,
    assetContractAddress: '0x0d9c8723b343a8368bebe0b5e89273ff8d712e3c',
    quantum: '10',
    amount: '1'
})
```

### `transferErc721({object}):Promise<string>`

> Transfer ERC721 token to a stark account. Returns signature.

**Arguments:**&#x20;

Object parameters:

| Value                  | Type   | Definition                |
| ---------------------- | ------ | ------------------------- |
| `senderVaultId`        | String | Sender vault ID           |
| `receiverVaultId`      | String | Receiver vault ID         |
| `receiverKey`          | String | Receiver stark key        |
| `nonce`                | String | Nonce                     |
| `expirationTimestamp`  | String | Expiration timestamp      |
| `condition`            | String | Conditional transfer hash |
| `assetContractAddress` | String | ERC721 contract address   |
| `tokenId`              | String | Token ID                  |

**Returns:**

`Promise<string>:` Returns a promise with transfer stark signature.

**Example:**

```javascript
const starkSignature = await starkProvider.depositErc721({
    senderVaultId: '10',
    receiverVaultId: '15',
    receiverKey: '0x04887f4c82218a6d13c6a0a249413e6e53b6910de5f0e6b5d85cfef1db04553b',
    nonce: '2433',
    expirationTimestamp: '1605826942',
    condition: null,
    assetContractAddress: '0x6B5E013ba22F08ED46d33Fa6d483Fd60e001262e',
    tokenId: '1234'
})
```

### `createOrder({object}):Promise<string>`

> Create a buy or sell limit order. Returns a signature

**Arguments:**&#x20;

Object parameters:

| Value                 | Type        | Definition           |
| --------------------- | ----------- | -------------------- |
| `sell`                | OrderParams | Sell order params    |
| `buy`                 | OrderParams | Buy order params.    |
| `nonce`               | String      | Nonce                |
| `expirationTimestamp` | String      | Expiration timestamp |

**`OrderParams`**

| Value     | Type      | Definition                                     |
| --------- | --------- | ---------------------------------------------- |
| `type`    | String    | Asset standard (e.g. `ETH`, `ERC20`, `ERC721)` |
| `data`    | AssetData | Asset data object                              |
| `amount`  | String    | Amount                                         |
| `vaultId` | String    | Vault ID                                       |

**`AssetData`**

| Value          | Type   | Definition                                                   |
| -------------- | ------ | ------------------------------------------------------------ |
| `quantum`      | String | Quantum value. Required if asset type is `ETH` or `ERC20`    |
| `tokenAddress` | String | Token address. Required if asset type is `ERC20` or `ERC721` |
| `tokenId`      | String | Token ID. Required if asset type is `ERC721`                 |

**Returns:**

`Promise<string>:`Returns a promise with transfer stark signature.

Example

```javascript
const starkSignature = await starkProvider.createOrder({
    sell: {
      type: 'ETH',
      data: {
        quantum: '1000'
      },
      amount: '1',
      vaultId: '10'
    },
    buy: {
      type: 'ERC20',
      data: {
        quantum: '10',
        tokenAddress: '0x0d9c8723b343a8368bebe0b5e89273ff8d712e3c'
      },
      amount: '2',
      vaultId: '15'
    },
    nonce: '2433',
    expirationTimestamp: '1605826942'
})
```

### ~~deserializeSignature(signature)~~

* Returns the `r` and `s` values of serialized signature.

**Arguments:**&#x20;

| Value       | Type   | Definition           |
| ----------- | ------ | -------------------- |
| `signature` | String | Signature hex string |

**Returns:**

`Promise<{r, s, recoveryParam?}>:` Returns object

**Example:**

```javascript
const {r, s} = starkProvider.deserializeSignature(signature)
```

### ~~serializeSignature({r, s, recoveryParam?}):string~~

* Returns the serialized signature.

**Arguments:**&#x20;

| Value           | Type   | Definition                          |
| --------------- | ------ | ----------------------------------- |
| `r`             | String | Signature `r value`                 |
| `v`             | String | Signature `v` value                 |
| `recoveryParam` | Number | (optional) Recovery parameter value |

**Returns:**

`Promise<string>: Returns serialized signature as hex string.`

**Example:**

```javascript
const signature = starkProvider.serializeSignature({r, s})
```

### `send(method, params):Promise<object>`

> Call StarkWare JSON RPC method with payload.

**Arguments:**&#x20;

| Value    | Type            | Definition                            |
| -------- | --------------- | ------------------------------------- |
| `method` | String          | Method name (e.g. `stark_transfer`)   |
| `params` | Object \| Array | Object or array containing parameters |

**Returns:**

`Promise<{id, result}>:` Returns promise with object containing response result.

**Example:**

```javascript
const method = 'stark_register'
const params = {ethKey, operatorSignature}
const txHash = starkProvider.send(method, params)
```

### `getAssetType({assetStandard, assetContractAddress?, quantum?, amount?}):Promise<string>`

> Returns asset type hash.

`TODO`

### `starkSignMessage(msg):Promise<string>`

> Signs message with stark key.

`TODO`

### `signMessage(msg):Promise<string>`

> Signs message with ethereum key.

`TODO`

### `signPersonalMessage(msg):Promise<string>`

> Signs personal message with ethereum key.

`TODO`

### `signTransaction(tx):Promise<string>`

> Sign transaction.

`TODO`

### `sendTransaction(tx):Promise<string>`

> Send transaction.

`TODO`

### `estimateGas(tx):Promise<string>`

> Estimate gas.

`TODO`

## Additional information

Please refer to the [StarkWare JSON RPC specification](https://hackmd.io/4XaD-LTeTLWGaNG-h-KHWA?view) for example inputs.

You can test out StarkWare methods in the [Authereum Ropsten Kitchen Sink](https://ropsten.demo.authereum.com/).


# SDK

## Authereum SDK

Using Authereum as a[ Web3 provider](/web3-provider) is recommended, but you can also use the Authereum SDK directly.

Example of initializing Authereum SDK:

```javascript
import Authereum from 'authereum

const authereum = new Authereum('kovan')
```

### Options:

* Networks
  * `mainnet`
  * `kovan`
  * `rinkeby`
  * `ropsten`
  * `goerli`<br>
* Configuration object and overrides
  * config
    * `networkName` - default: `mainnet`
    * `apiKey` - default: `null` use your [API key](/api-keys)
    * `rpcUri` - default: `https://mainnet.rpc.authereum.com`
    * `webUri` - default: `https://authereum.com`
    * `xsUri` - default: `https://x.authereum.com`
    * `disableNotifications` - default: `false`
    * `blockedPopupRedirect` - default `true`
    * `forceRedirect` - default `false`
* &#x20;Example:

  ```javascript
  const authereum = new Authereum({
    networkName: 'kovan',
    disableNotifications: true
  })
  ```
* * Example:

    ```javascript
    const authereum = new Authereum({
      rpcUri: 'https://kovan.infura.io'
    })
    ```

NOTE: Using private chains or custom local RPC urls are not supported at the moment. Read the [FAQ](https://developers.authereum.org/faq) for more info.

### Events

* `ready`&#x20;
  * &#x20;Emitted when SDK is ready to be used
* `iframeReady`
  * Emitted when iframe connection is ready
* `openPopup`

  Emitted when popup has opened, typically from a login request.
* `closePopup`
  * Emitted when popup has closed, typically from logging in.
* `popupBlocked`
  * Emitted when the login popup is blocked by the browser.
* `login`
  * Emitted when user successfully logged in.
* `logout`
  * Emitted when user logs out.
* `dappKeyExpired`
  * Emitted when the dapp key expires.
* `error`
  * Emitted when ever there's an error.

### Methods

* `login()`
  * Show login window to authenticate.
* `logout()`
  * Logout from dapp.
* `showWidget(bool?)`
  * Show Authereum widget on page.
* `hideWidget()`&#x20;
  * Hide Authereum widget from page.
* `getDappKey()`
  * Get  logged in user's dapp key info like public address
* `getTransactionReceipt(transactionHash)`
  * Returns the transaction receipt with `receipt.status` being `false` if the top-level transaction failed or any of the internal transactions failed. The receipt status will be `true` if both the top-level transaction succeeded and all the internal transactions succeeded.&#x20;
* `hasRecoveryEnabled()`
  * Returns `true` if user has a recovery option set.
* `waitForTransactionReceipt(transactionHash)`
  * Will wait for transaction to be mined to return transaction receipt.
* `signMessageWithSigningKey(message)`
  * Sign a message using a persistent key dedicated for signing message. Check [browser compatibility](/browser-compatibility) before using this method since it relies on cross-site storage.
* `getSigningKeyAddress()`
  * Returns the public address of the signing key.
* `isAuthenticated()`
  * Returns `true` if user is logged into dapp with Authereum.
* `isContractDeployed(accountAddress?)`
  * Returns `true` if account address is a deployed contract.
* `addFunds(options?)`
  * Render a fiat on-ramp modal to buy ETH or DAI.
  * The optional options object is for filtering the payment options available.
    * `countryCode` : 2-letter country code (ie 'US', 'GB', etc)
    * `tokenSymbol` : Token symbol (ie 'ETH', 'DAI' ,etc)
    * `sourceAmount` : Source fiat amount (ie 25, 100, etc)
    * Example:
      * ```
        authereum.addFunds({
          countryCode: 'US',
          tokenSymbol: 'DAI',
          sourceAmount: 25
        })
        ```
* `version()`
  * Returns the SDK version.

## Browserify example

Install authereum sdk:

```bash
npm i authereum
```

Install browserify globally:

```bash
npm i -g browserify
```

Initialize authereum sdk in `index.js`&#x20;

```javascript
const { Authereum } = require('authereum')

const authereum = new Authereum()
authereum.login()
```

Browserify `index.js` to create a bundled file which can be ran in the browser:

```bash
browserify index.js > bundle.js
```

Include the script tag with `bundle.js` in your html:

```markup
<!DOCTYPE html>
<html lang="en-US">
<head>
  <meta charset="UTF-8">
  <title></title>
</head>
<body>
  <script src="bundle.js"></script>
</body>
</html>

```

## Examples

### **Logging in:**

```javascript
import Authereum from 'authereum

const authereum = new Authereum('kovan')
await authereum.login()
```

### **Getting account address:**

```javascript
import Authereum from 'authereum

const authereum = new Authereum('kovan')
const address = await authereum.getAccountAddress()
```

### **Events:**

```javascript
import Authereum from 'authereum

const authereum = new Authereum('kovan')

authereum
.on('ready', () => {
  console.log('ready')
})
.on('error', err => {
  console.error(err)
})
```


# API Keys

Generating and using API Keys

⚠️ API keys are currently not being enforced but will be enforced in the near future!

Go to[ authereum.com/dashboard](https://authereum.com/dashboard) to get your api key to avoid being rate limited.&#x20;

Include the API key in the configuration object when initializaing the Authereum SDK:

```javascript
import Authereum from 'authereum

const authereum = new Authereum({
  networkName: 'mainnet',
  apiKey: 'y7edbh5uw4eTpLg8JAk7tHdzfMOT6wlB'
})

await authereum.login()
```


# Batched transactions

Authereum supported batched transactions right out of the box. This means that you can send an array of transactions and they will all get processed in 1 single transaction. Authereum batched transactions are also atomic meaning that all transactions in the batch must succeed, otherwise if any of the batched transactions fails then they are all cancelled.&#x20;

For example, a common series of transaction is an `approve` and `transfer` call with ERC20 tokens. With batched transactions you can approve and transfer in a single transaction. If the approve call fails then the transfer call won't happen since the transaction before it failed. If the approve succeeds but the transfer fails then approve call is reverted and cancelled. If the approve succeeds and transfer succeeds then the entire transaction is successful.

In order to estimate the gas for a batched transaction, you can call `estimateGasBatch` on the provider. This will return an array of numbers that represent the estimated gas, one for each transaction in the batch.

To learn how to implement batched transactions with the web3 provider, check out the documentation link below:

{% content-ref url="/pages/-Lu-Yjsb12c254kb1gy\_" %}
[Web3 provider](/web3-provider)
{% endcontent-ref %}


# Verifying signatures

## Verifying Signatures with EIP-1271

Since contracts can’t generate signatures therefore `ecrecover`won’t work if the address is a contract, then the contract-based account needs to use the [EIP1271](https://github.com/ethereum/EIPs/blob/master/EIPS/eip-1271.md) standard to verify signatures for contracts.&#x20;

Verifying contract-based account signatures require calling the EIP1271 `isValidSignature( data, signature)` method on the account contract. Authereum, Dapper wallet, 0xProject, and a few others are already using EIP1271 to verify signatures where the "recovered address" is a contract address.

Below are examples of how to verify Authereum dapp key signatures:

### Using Web3.js

```javascript
const Web3 = require('web3')

const provider = new Web3.providers.HttpProvider('https://kovan.infura.io')
const web3 = new Web3(provider)

const eip1271Abi = [
  {
    "constant": true,
    "inputs": [
      {
        "name": "_messageHash",
        "type": "bytes"
      },
      {
        "name": "_signature",
        "type": "bytes"
      }
    ],
    "name": "isValidSignature",
    "outputs": [
      {
        "name": "magicValue",
        "type": "bytes4"
      }
    ],
    "payable": false,
    "stateMutability": "view",
    "type": "function"
  }
]

const account = '0x99bd0006D13542A0917Cf8F2F986Ca7667b84268'
const data = '0x47173285a8d7341e5e972fc677286384f802f8ef42a5ec5f03bbfa254cb01fad'
const signature = '0x0304494527023df3a811f5ad61aa35177a4455eb4bf098561f9380a574915f4c1ff4a5fc653afdfc086dcc9662848097703d18b82156618ccec1e5c9da7623e51b4760269d07f9a074dc2d6ab10cf52ff77852662e40fbb4b27289126a5bb538271e147c0952204161d710bb070a6e470b0b1ef65d11f1dc074e235e3dfaef00ae1b'

const magicValue = '0x20c13b0b'
const instance = await new web3.eth.Contract(eip1271Abi, account)
const result = await instance.methods.isValidSignature(data, signature).call()
const verified = (result === magicValue)

console.log(verified) // true
```

The `isValidSignature` method returns a magic which is computed from `bytes4(keccak256("isValidSignature(bytes,bytes)").` The reason for returning a magic value to avoid accidentally returning `true`.

### Using ethers.js

```javascript
const ethers = require('ethers')

const provider = ethers.getDefaultProvider('kovan')

const eip1271Abi = [
  {
    "constant": true,
    "inputs": [
      {
        "name": "_messageHash",
        "type": "bytes"
      },
      {
        "name": "_signature",
        "type": "bytes"
      }
    ],
    "name": "isValidSignature",
    "outputs": [
      {
        "name": "magicValue",
        "type": "bytes4"
      }
    ],
    "payable": false,
    "stateMutability": "view",
    "type": "function"
  }
]

const account = '0x99bd0006D13542A0917Cf8F2F986Ca7667b84268'
const data = '0x47173285a8d7341e5e972fc677286384f802f8ef42a5ec5f03bbfa254cb01fad'
const signature = '0x0304494527023df3a811f5ad61aa35177a4455eb4bf098561f9380a574915f4c1ff4a5fc653afdfc086dcc9662848097703d18b82156618ccec1e5c9da7623e51b4760269d07f9a074dc2d6ab10cf52ff77852662e40fbb4b27289126a5bb538271e147c0952204161d710bb070a6e470b0b1ef65d11f1dc074e235e3dfaef00ae1b'

const magicValue = '0x20c13b0b'
const instance = new ethers.Contract(account, eip1271Abi, provider)
const result = await instance.isValidSignature(data, signature)
const verified = (result === magicValue)

console.log(verified) // true
```

### Using NPM package helper

For convenience, there's the [~~`is-valid-signature`~~](https://www.npmjs.com/package/is-valid-signature) NPM package you can use to validate signature for account contracts.&#x20;

```javascript
const validateContractSignature = require('is-valid-signature')
const Web3 = require('web3')

const provider = new Web3.providers.HttpProvider('https://kovan.infura.io')

const account = '0x99bd0006D13542A0917Cf8F2F986Ca7667b84268'
const data = '0x47173285a8d7341e5e972fc677286384f802f8ef42a5ec5f03bbfa254cb01fad'
const signature = '0x0304494527023df3a811f5ad61aa35177a4455eb4bf098561f9380a574915f4c1ff4a5fc653afdfc086dcc9662848097703d18b82156618ccec1e5c9da7623e51b4760269d07f9a074dc2d6ab10cf52ff77852662e40fbb4b27289126a5bb538271e147c0952204161d710bb070a6e470b0b1ef65d11f1dc074e235e3dfaef00ae1b'

const verified = await validateContractSignature(account, data, signature, provider)

console.log(verified) // true
```

### Resources

* [EIP-1271 specification](https://github.com/ethereum/EIPs/blob/master/EIPS/eip-1271.md)
* [ERC-1271 : Standard Signature Validation Method for Contracts](https://github.com/ethereum/EIPs/issues/1271)
* [`is-valid-signature`](https://www.npmjs.com/package/is-valid-signature) NPM Module
* [Signature-based authentication server example](https://github.com/authereum/signature-based-authentication-example)


# Testing

### DAI addresses

* Mainnet: [0x6B175474E89094C44Da98b954EedeAC495271d0F](https://etherscan.io/address/0x6b175474e89094c44da98b954eedeac495271d0f)&#x20;
* Kovan: [0x7d669A64deb8a4A51eEa755bb0E19FD39CE25Ae9](https://kovan.etherscan.io/address/0x7d669a64deb8a4a51eea755bb0e19fd39ce25ae9)
* Goerli: [0xF2D1F94310823FE26cFa9c9B6fD152834b8E7849](https://goerli.etherscan.io/address/0xf2d1f94310823fe26cfa9c9b6fd152834b8e7849)
* Rinkeby: [0xc3dbf84Abb494ce5199D5d4D815b10EC29529ff8](https://rinkeby.etherscan.io/address/0xc3dbf84Abb494ce5199D5d4D815b10EC29529ff8)
* Ropsten: [0x2D69aD895797C880abce92437788047BA0Eb7fF6](https://ropsten.etherscan.io/address/0x2D69aD895797C880abce92437788047BA0Eb7fF6)

You can mint your own DAI on any testnet by calling the `mint` function on the respective contracts.

The testnet DAI addresses are derived from [here](https://twitter.com/PaulRBerg/status/1198276650884124674?s=19).

You may use the [demo kitchen sink](https://developers.authereum.org/live-demos#kitchen-sinks) to submit transactions.


# Browser compatibility

Authereum browser compatibility information

## General

In order for Authereum to function properly without any issues, do the following:

* Do not use ad blockers on Authereum enabled sites (often labeled under *shields*)
* Enable cross-site storage in browser settings (often labeled under *cookies* or *trackers*)

### Browser Test

You can visit the [browser test ](https://browser-test.authereum.com)page to see if your browser or browser settings is compatible with Authereum:

[https://browser-test.authereum.com](https://browser-test.authereum.com/)

![](/files/-M2AuZUiN3tpRLL_eh_E)

## Safari (desktop)

#### Version supported: 13+

Browser supported: [✔️](https://emojipedia.org/check-mark/) (requires cross-site storage enabled)

Private window supported: [❌](https://emojipedia.org/cross-mark/)

#### Requirements:

* Cross-site storage
* Disabled pop-up blocker

Safari by default disables cross-site storage reading. Authereum requires cross-site storage reading to read sandboxed signing keys that live in the browser local storage.

Safari disallows cross-site storage in private mode so it won't be possible to use Authereum on Safari Private window mode.

#### To enable cross-site storage follow these steps:

*Safari* → *Preferences* → *Privacy* → Uncheck [⭕](https://emojiterra.com/heavy-large-circle/) **Prevent cross-site tracking**

![Uncheck "Prevent cross-site tracking" setting](/files/-M2Aeumh_Xzt-ASZNFS0)

#### To enable pop-ups follow these steps:

*Safari* → *Preferences* → *Websites* → **Allow**

![Change dropdown setting to "Allow" for the website](/files/-M2AeumgOgR0Pg77ot6a)

## Safari (iOS)

#### Version supported: 13+

Browser supported: [✔️](https://emojipedia.org/check-mark/)  (requires cross-site storage enabled)

Private window supported: [✔️](https://emojipedia.org/check-mark/)  (requires cross-site storage enabled)

#### Requirements:

* See [Safari (desktop) ⬆️](/browser-compatibility#safari-desktop):&#x20;

#### To enable cross-site storage follow these steps:

*Settings* → *Safari* → *Privacy & Security* → Uncheck [⭕](https://emojiterra.com/heavy-large-circle/) **Prevent Cross-Site Tracking**

![Toggle off "Prevent Cross-Site Tracking" switch](/files/-M2ZJbHgWcboJdWUW9gH)

#### To enable pop-ups follow these steps:

*Settings* → *Safari* → *General* → Uncheck [⭕](https://emojiterra.com/heavy-large-circle/) **Block Pop-ups**

![Toggle off "Block Pop-ups" switch](/files/-M2ZJsxUXf25PQoWULTz)

![](/files/-M2AuZUhJgy5pIaAFo_F)

## Chrome (desktop)

#### Version supported: 80+

Browser supported: [✔️](https://emojipedia.org/check-mark/)

Incognito window supported (version 83 or under): [✔️](https://emojipedia.org/check-mark/)

Incognito window supported (version 84+): [❌](https://emojipedia.org/cross-mark/) (requires cross-site storage enabled)

#### Requirements:

* Cross-site storage
* Disabled pop-up blocker

**To enable cross-site storage in Incognito follow these steps (for versions 84+):**

*New tab* → *Block third-party cookies* → Uncheck [⭕](https://emojiterra.com/heavy-large-circle/) **Block third-party cookies**

![](/files/-MDbRHUe1u1Al5p5ugpX)

**To enable cross-site storage follow these steps (for versions 84+):**

*Menu* → *Settings* → *Privacy and Security* → *Site Settings* → *Cookies and site data* → *General settings* → Check [✔️](https://emojipedia.org/check-mark/) **Allow all cookies**

![](/files/-MDbSZ3_Pvj7eDMPNFlz)

**To enable cross-site storage follow these steps (for versions 83 or under):**

*Menu* → *Settings* → *Privacy and Security* → *Site Settings* → *Cookies and site data* → Uncheck [⭕](https://emojiterra.com/heavy-large-circle/) **Block third-party cookies**

![Uncheck "Block third-party cookies" setting](/files/-M2AeumdFnzF0Dv9GFZG)

#### To enable pop-ups follow these steps:

*Menu* → *Settings* → *Privacy and Security* → *Site Settings* → *Pop-ups and redirects* → Uncheck [⭕](https://emojiterra.com/heavy-large-circle/) **Blocked (recommended)**

![Uncheck "Blocked (recommended)" setting](/files/-M2AeumfBr9AwescYw5J)

![](/files/-M2AuZUf4HHDsY5szn5D)

## Firefox (desktop)

#### Version supported: 74+

Browser supported: [✔️](https://emojipedia.org/check-mark/)

Private window supported: [❌](https://emojipedia.org/cross-mark/)

#### Requirements:

* Disabled pop-up blocker

#### To enable pop-ups follow these steps:

*Menu* → *Preferences* → *Privacy & Security* → Uncheck [⭕](https://emojiterra.com/heavy-large-circle/) **Block pop-up windows**

![Uncheck "Block pop-up windows" setting](/files/-M2AeumVbGyyMnWH5aR6)

![](/files/-M2AuZUkDT-WUNZiMPmp)

## Opera (desktop)

#### Version supported: 67+

Browser supported: [✔️](https://emojipedia.org/check-mark/)

Private window supported: [✔️](https://emojipedia.org/check-mark/)

#### Requirements:

* See [Chrome ⬆️](/browser-compatibility#chrome-desktop):&#x20;

![](/files/-M2AuZUSbxSS4_Z4SyiV)

## Microsoft Edge (desktop)

#### Version supported: 80+

Browser supported: [✔️](https://emojipedia.org/check-mark/)

InPrivate window supported: [✔️](https://emojipedia.org/check-mark/)

#### Requirements:

* See [Chrome ⬆️](/browser-compatibility#chrome-desktop):&#x20;

![](/files/-M2AvsPM0CXX0sNs2b-P)

## Brave (desktop)

#### Version supported: 80+

Browser supported: [✔️](https://emojipedia.org/check-mark/)  (requires cross-site storage enabled)

Incognito window supported: [✔️](https://emojipedia.org/check-mark/)  (requires cross-site storage enabled)

#### Requirements:

* Disable Shield and allow third party cookies
* See [Chrome ⬆️](/browser-compatibility#chrome-desktop) for more requirements:&#x20;

**To enable cross-site storage follow these steps:**

*Shield* →  Uncheck [⭕](https://emojiterra.com/heavy-large-circle/) **Cross-site trackers blocked**

*Shield* →  Uncheck [⭕](https://emojiterra.com/heavy-large-circle/) **Scripts blocked**

*Shield* →  *scripts blocked* →  Select **All cookies allowed**

![Uncheck "Cross-site trackers blocked" and select "Allow cookies Allowed"](/files/-M3rdr8I3k57VpJVwjLs)

#### To completely disable shield follow these steps:

*Shield* → *If a site appears broke, try shields dow*n → Uncheck [⭕](https://emojiterra.com/heavy-large-circle/) *Shields UP for this site* so that it says **Shields DOWN for this site**

![Uncheck shield switch to completely disable shield](/files/-M3rdu8tXCC3sSygsoXx)

## Other browsers

If you encounter any browser issues, please let us know:

{% content-ref url="/pages/-M3gsba3h7R3jjIUHC\_f" %}
[Bug reports](/bug-reports)
{% endcontent-ref %}


# Contributing

If you'd like to contribute to Authereum in some capacity, please reach out to us on [Telegram](https://t.me/authereum).

We also love bug reports! Ping us on the Telegram [channel](https://t.me/authereum) to report any issues.


# Bug reports

Reporting issues and bugs

Reach out to use on [Telegram](https://t.me/authereum) if you encounter any issues!


# FAQ

### Where are private keys stored?

When a user signs up on Authereum, a new contract-based account is deployed. Each account contract requires keys to manage it, so when you signed up a new key pair was also generated on your browser client-side. This key is encrypted with a password derived key (PBKDF2). Keys are stored in browser local storage and the encrypted keystore is stored on Authereum so that you can login in different devices.

You can always export the management key (also called Admin key) from the [export page](https://accounts.authereum.org/settings/export) in settings or add additional admin keys on the [admin keys page.](https://accounts.authereum.org/settings/admin-keys)

A more detailed explanation can be read in the [Authereum Key Architecture Explained](https://medium.com/authereum/authereum-key-architecture-explained-8e0781cf3ea0) article.

### Can I implement signature-based authentication on my dapp using Authereum?

Yes! Authereum is offered as a web3 provider so the user on the dapp can generate a signature given a challenge string provided by the dapp and then verify the signatures on the backend using [EIP1271](https://github.com/ethereum/EIPs/blob/master/EIPS/eip-1271.md). A number of dapps that have integrated Authereum are doing signature based authentication. Read the [Verifying Signatures](https://developers.authereum.org/verifying-signatures) section for examples on using EIP1271 for verifying contract-based account signatures and check out the section on [signing message](/web3-provider#sign-message) using the web3 provider.

For a simple example on how to implement this in Node.js, check out the [signature-based authentication example](https://github.com/authereum/signature-based-authentication-example).

### Can I use the Authereum provider in node.js?

The Authereum provider is meant to be used on the browser because it relies on iframe communication to access sandboxed local storage. If running with node directly then it won't work but we are working on a provider that would work with node for backends.

### Does a relayer have access to my Authereum account?

Only you, the owner of the account, has access to the contract-based account (CBA). The relayer, or anyone else for that matter, does not have access to your CBA. The relayer takes your signed transaction and attaches the gas fee. The CBA meta-transaction method is responsible for refunding the relayer after the user's transaction has been processed.

### Should I be using the Authereum SDK or the Authereum web3 provider?

We recommend using the Authereum [web3 provider ](/web3-provider)whereever possible. The Authereum web3 provider is essentially a wrapper aound the Authereum SDK. Most dapps are built using a web3 provider so using the Authereum web3 provider should work as a drop-in replacment for MetaMask.

### Can I use Authereum with ganache or local testrpc?

Not yet, but we are working on adding support for this.

### Can I use WalletConnect with Authereum?

Yes! Authereum support [WalletConnect](https://walletconnect.org). Simply scan a WalletConnect-enabled QRCode to setup the connection.

### Can I pay to give my dapp users free transactions through the Authereum relayer?

Yes! Reach out to us on Telegram or email.

### If I create an account on one testnet, will it be available on other testnets?

No, this doesn't happen because each testnet is a separate chain and account creating involves deployment a smart contract to that testnet.&#x20;

### Can I use a private chain or custom local RPC for testing?

It's not possible at the moment but we are currently working on ways to use local RPCs. It's more challenging than anticipated because of different moving parts so we can't give a definite time when we'll have something ready but it's in the works.

### Does Authereum offer a white-label solution?

A white-label solution is something we're discussing about offering in the long-term. No short-term plans on a white-label solution. We'd love to hear what features you're looking for; message us on [telegram](https://t.me/authereum).

### Why doesn't Authereum work on my browser?

In order to be non-custodial, your wallet keys are decrypted and loaded into your browsers local storage under a sandboxed domain. When using a dapp, the Authereum SDK must communicate to the sandboxed domain to send requests for the private key to sign. This communication between domains is called 3rd-party communication and access to the local storage is called 3rd-party storage access, although different browsers might use different terminology such as 3rd-party cookies or 3rd-party session data. When using a browser in private mode or with shields enabled, the browser blocks 3rd-party access to the local storage which means the Authereum SDK can no longer store the private key under the sandboxed domain so in order for it to work 3rd-party access to storage must be enabled. To learn how to enable these settings, please visit the [browser compatibilty](/browser-compatibility) page.

### In there a React Native SDK available?

Not yet but we'll be working on one soon.

### Is the Authereum SDK open source?

Not yet but it will be open source once it's more stable since we're tightening things down.

### Is there an Authereum browser extension I can use?

Not yet but we are working on one.

### Why do I need to deposit ETH into my account after signing up?

Due to the [high gas market](https://medium.com/authereum/gas-policy-update-2-650fc4faf549) it became uneconomical to sponsor new account deployments. As of August 2020, new accounts will require users to pay the on-chain transaction fee for the contract-based account deployment.

### Which browsers support the QRCode scanner?

* iOS:
  * Safari only. Other browsers require image upload.
* Android:
  * All browsers.
* Desktop:
  * All browsers, as long the computer has a webcam.

### How do I set up account recovery?

Account recovery can be configured in the [account recovery settings](https://authereum.com/settings/recovery/recovery-account) page.

### How can I access my contract based account if Authereum ceases to exist?

There's an open source simple react app (<https://github.com/authereum/direct>) that anyone can download and run to interact directly with their contract-based account. This doesn't require any Authereum services and communicates directly with the chain. Please make sure to export your admin key first from the settings page or add an additional admin key such as your MetaMask address since transactions made to your contract-based account need to come from an admin key account.

### Where can I read more FAQs?

For more FAQs, please visit the help center to view Frequently Asked Questions: [https://support.authereum.com](https://support.authereum.com/)


# Dictionary

Terminology used in Authereum

### Admin key

Admin keys (previously called Auth keys) are keys that have full authority of a contract-based account. Admin keys can add or remove other admin keys. Admin keys should be fully secured.

### Auth key

See [Admin key](/dictionary#admin-key).

### Dapp key

Dapp keys (previously called Login keys) are ephemeral keys generated when logging in to dapps. Dapp keys can only be used for signing transactions. Dapp keys may have more restrictions to provide more security on questionable dapps. Dapp keys cannot add or remove admin keys.

### Login key

See [Dapp key](/dictionary#dapp-key).

### Relayer

A relayer is a service that attaches the gas fee for a transaction. The relayer is typically refunded by the original transaction signer. Some relayers accept the refund to be in a token instead of ETH.


# On the Web

### Find us on:

* [Web: authereum.com](https://authereum.com)
* [Twitter: @authereum](https://twitter.com/authereum)
* [Github: @authereum](https://github.com/authereum)
* [Medium: @authereum](https://medium.com/authereum)
* [Telegram: @authereum](https://github.com/authereum)
* [Reddit: /r/authereum](https://www.reddit.com/r/authereum/)
* [Discord: https://discord.gg/35a2yJGf9y](https://discord.gg/35a2yJGf9y)


# Telegram Admins

Official Authereum groups and admins

The official Telegram for Authereum is:

* <https://t.me/authereum>

Admins will **never** ask for private keys or sensitive information.

Check for `admin` label on channel messages to verify that it's an admin.

![](/files/-MPqDg2vmglSxvL-LgzR)

### Report scam accounts

Any other account reaching out on behalf of Authereum is a scam and should be reported!

Beware of accounts that have similar usernames. For example, the capital letter `i` will look like the lowercase letter `L` in Telegram! You can use a character checker such as [this one](https://text-compare.com/).

Best practice would be to file an issue through our official support desk at [support.authereum.com](https://support.authereum.com/hc/en-us) to avoid scammers.


# Assets

Authereum design assets

## Colors

| Hex                                                                | RGB                                                                       |
| ------------------------------------------------------------------ | ------------------------------------------------------------------------- |
| ![#ff4c2e](https://placehold.it/15/ff4c2e/000000?text=+) `#ff4c2e` | ![#ff4c2e](https://placehold.it/15/ff4c2e/000000?text=+) `rgb(255,76,46)` |
| ![#00172B](https://placehold.it/15/00172B/000000?text=+) `#00172B` | ![#00172B](https://placehold.it/15/00172B/000000?text=+) `rgb(0,23,43)`   |

## Logos

### Shield Logo

| SVG                                                               | PNG                                                               |
| ----------------------------------------------------------------- | ----------------------------------------------------------------- |
| <p></p><p><img src="/files/-M5Yk_4RdkYkaQ9BFMc5" alt="image"></p> | <p></p><p><img src="/files/-M5Ykbf_sxVmEKN0CScG" alt="image"></p> |

### Full Logo

| SVG                                                               | PNG                                                               |
| ----------------------------------------------------------------- | ----------------------------------------------------------------- |
| <p></p><p><img src="/files/-M5Yl81Uu45Riqsm4INp" alt="image"></p> | <p></p><p><img src="/files/-M5YkiT9wz8_x-crKKHM" alt="image"></p> |

### Full Logo with White Text

| SVG                                                                      | PNG                                                               |
| ------------------------------------------------------------------------ | ----------------------------------------------------------------- |
| <p></p><p></p><p><img src="/files/-M5YkmL99WQtFd2QVEKu" alt="image"></p> | <p></p><p><img src="/files/-M5YkpMmL7woSFmquZB0" alt="image"></p> |

### Full logo (Black)

| SVG                                                               | PNG                                                               |
| ----------------------------------------------------------------- | ----------------------------------------------------------------- |
| <p></p><p><img src="/files/-M5Ykt48dMEyhSzkTIXS" alt="image"></p> | <p></p><p><img src="/files/-M5YkvlANx3EOruIyt1r" alt="image"></p> |

### Full logo (White)

| SVG                                                               | PNG                                                               |
| ----------------------------------------------------------------- | ----------------------------------------------------------------- |
| <p></p><p><img src="/files/-M5Ykz-Z6w--w9kRHrg5" alt="image"></p> | <p></p><p><img src="/files/-M5Yl0t8pGarGRGzM7Cx" alt="image"></p> |

###

### Shield Logo (Black)

| SVG                                                                             | PNG                                                               |
| ------------------------------------------------------------------------------- | ----------------------------------------------------------------- |
| <p></p><p></p><p><img src="/files/-M5YkTF8kDlKuoFthawS" alt="image"></p><p></p> | <p></p><p><img src="/files/-M5YkWFWz8VmYUROn3XD" alt="image"></p> |

### Shield Logo (White)

| SVG                                                               | PNG                                                               |
| ----------------------------------------------------------------- | ----------------------------------------------------------------- |
| <p></p><p><img src="/files/-M5YjvO-ktqOkRkNXJhY" alt="image"></p> | <p></p><p><img src="/files/-M5YjyagHa7-KhLmaZj4" alt="image"></p> |

## Press Kit

[Download Press Kit](https://s3.amazonaws.com/assets.authereum.org/authereum_press_kit.zip)


