Documentation Checkout API Username API Wallets API Miscellaneous

Authentication API (Beta)

Non-custodial Auth API for the Nano blockchain.

Basic Usage

<script src="https://unpkg.com/axios/dist/axios.min.js"></script>

<script>
axios.post('https://rpc.nano.to', {
  "action": "nano_login",
  "address": "@username" // Free login
  "platform": "YOUR_APP_NANO_ADDRESS", // Users pay you
  "amount": "0.0001XXX" // Custom login price
}).then((res) => {
  console.log(res.data)
})
</script>

Response:

{
  "id": "CHECKOUT_ID",
  "browser": "https://nano.to/CHECKOUT_ID",
  "json": "https://api.nano.to/checkout/CHECKOUT_ID",
  "check": "https://api.nano.to/confirm/CHECKOUT_ID",
  "address": "YOUR_ADDRESS",
  "amount": "0.13300004758",
  "amount_raw": "133000047580000000000000000000",
  "link": "nano:YOUR_ADDRESS?amount=133000047580000000000000000000",
  "qrcode": "data:image/png;base64.."
}

Confirm Payment

Perform a GET request on check URL to confirm payment.

Payment Found:

{
  "address": "nano_37y6iq8m1zx9inwkkcgqh34kqsihzpjfwgp9jir8xpb9jrcwhkmoxpo61f4o",
  "block": "A16AB6430A3A9861F10EE39B45D3CF35137E395642BF518D28FD7A9F32B358D1",
  "username": "development",
  "session": "NANO-SESSION-30A3A9861F10EE39B30A3A9861F10EE39B45D3CF3510EE39B45D3CF355B45D3CF35D1",
  "expiration": 1714999955
}

Payment Not Found

{ 
  "error": 404,
  "message":"Payment not found."
}

Retrieve Account

const axios = require('axios');

axios.post('https://rpc.nano.to', {
  "action": "nano_login", 
  "session": "NANO-SESSION-30A3A9861F10EE39B30A3A9861F10EE39B45D3CF3510EE39B45D3CF355B45D3CF35D1"
})

Response:

{
  "name": "development",
  "goal_ui": "2000:Business Wallet",
  "address": "nano_37y6iq8m1zx9inwkkcgqh34kqsihzpjfwgp9jir8xpb9jrcwhkmoxpo61f4o",
  "created": "December 26, 2021",
  "expires": "December 25, 2033",
  "created_unix": 1640552100,
  "expires_unix": 2019099600,
  "status": "active",
  "title": "Research & Development",
  "github": "nano2dev",
  "mastodon": "xno.social/@nano2dev",
  "twitter": "nano2dev",
  "location": "US-East"
}

Update Metadata

const axios = require('axios');

axios.post('https://rpc.nano.to', {
  "action": "nano_login", 
  "session": "NANO-SESSION-30A3A9861F10EE39B30A3A9861F10EE39B45D3CF3510EE39B45D3CF355B45D3CF35D1",
  "metadata": { "hello": "world" }
})

Only updating metadata is currently supported. Max object size: 10MB

Response:

{
  "name": "development",
  "metadata": { "hello": "world" }
  // ...
}

Available Options

NanoPay.js

NanoPay.js is a client-side Javascript library Nano.

Simply pass the Checkout id.

<script src="https://pay.nano.to/latest.js"></script>

<script>
  // Pass the checkout.id to NanoPay.js
  NanoPay.open({ 
      checkout: checkout.id, // checkount from backe-end
      success: (block) => {
        console.log(block.session) 
      }
  })
</script>

Nano.to Support