Arc
Search
K
Comment on page

Register Users

Register users in your Arc application.

Generate keys

In Arc a user is uniquely identified by a unique ID, assigned upon registration, as well as a STARK public key used to authenticate user operations. Information on how to create and manage STARK keys can be found on the following page:

Submit registration request

In order for applications to register users in the Arc API, an HTTP POST request to /api/v1/users with the following fields is required:
post
https://testnet-api.onarc.io
/api/v1/users
Register new User
The address is the Ethereum EOA public key.
The EIP712 signature is a signature of a application specific payload, returned by the /api/v1/users/register-details endpoint, signed by the user’s Ethereum EOA private key, to prove that the user is indeed the owner of the provided address. This signing standard is already supported by multiple wallets. The following articles from Metamask should help calculate this signature:
get
https://testnet-api.onarc.io
/api/v1/users/register-details
Get EIP712 data to be signed
The Stark Signature is a signature of the user's Ethereum address with the User’s private Stark Key, to prove that the user is indeed the owner of the provided starkKey. In order to generate this signature, you can use Arc's C# SDK:
After successfully registering a new user, Arc will return the following body:
// Response Body
{
"id": "03d6e914-3135-4933-9f29-fc158c4dffad",
"username": "vitalik",
"starkKey": "0x3d8a9687c613b2be32b55c5c0460e012b592e2fbbb4fc281fb87b0d8c441b3e",
"address": "0x1337fc10deb4ef09a1c3743ba9930b5ba5882637",
}
The ID is the unique identifier for the new user in the Arc application.
In the snippet below, we demonstrate the full registration process of a new user after already deriving its STARK keys from an Ethereum account:
Typescript
C#
Python
// init stark express client
const arcClient: Client = await ClientFactory.createDefaultClient(
DefaultProviderUrls.TESTNET,
apiKey,
);
// init cryptoUtils
const cryptoUtils: ICryptoUtils = new CryptoUtils();
await cryptoUtils.init(message);
// get register details
const registerDetails = (await arcClient.user().getEIP712SignableData({
username: username,
starkKey: cryptoUtils.starkAccount.publicKey,
address: cryptoUtils.signer.address,
})) as TypedMessage<MessageTypes>;
// get signed register details
const registerModel = await cryptoUtils
.user()
.signRegisterDetails('evgenip', registerDetails);
// register a new user
const registeredUser: ResponseData<IRegisteredUser> = await arcClient
.user()
.registerNewUser(registerModel);
// How to register new users on Arc using the C# SDK
// To generate your Stark Key, check the STARK Keys section
var username = "Your username";
// Get typed data to sign with EIP712
var typedDataToSignResponse = await starkExpressClient.UserApi.EIP712DetailsAsync(
username,
newStarkAccount.PublicKey, // STARK Public key
newEthereumAccount.Address); // EOA address
var registerRequest = new RegisterUserModel(
username,
newStarkAccount.PublicKey, // STARK Public key
newStarkAccount.SignAddress(newEthereumAccount.Address), // STARK Signature
newEthereumAccount.Address, // EOA address
newEthereumAccount.SignTypedData(typedDataToSignResponse.Body)); //EIP712 Signature
// Register a new user
await starkExpressClient.UserApi.RegisterUserAsync(registerRequest);
# Python SDK release soon

Confirm Registration

To confirm the user registration, you can request the user details from the /api/v1/users/{userId} endpoint using the user ID received during registration. As an alternative, a application can list all users using the /api/v1/users/ API endpoint. Here is an example.
get
https://testnet-api.onarc.io
/api/v1/users/{userId}
Get User
The request should return the original registered user:
Response
{
"id": "03d6e914-3135-4933-9f29-fc158c4dffad",
"username": "vitalik",
"starkKey": "0x3d8a9687c613b2be32b55c5c0460e012b592e2fbbb4fc281fb87b0d8c441b3e",
"address": "0x1337fc10deb4ef09a1c3743ba9930b5ba5882637",
}