Alore API: Creating an Account & Sending in 10 minutes
First of all, you can start by creating your Alore account so you can get access to your API key. You can generate your key by going through Settings -> API keys -> ‘click to regenerate the key’
.
When you regenerate an API key, it's secret is changed, but all data related to this api key will remain the same.
Now you have your API key, which represents your first project using Alore. Let’s start building!
For this tutorial you will need to use our alore-js
library to call this linked function to derivate a wallet keyshare from your API keyshare.
1. Creating a Wallet
In Alore, Wallets are like vaults, they hold accounts and have unique configurations such as Contacts, Recovery methods, Roles, and dashboard information.
1.1 Create Wallet Keyshare
The first step is to generate a keyshare for your wallet. This keyshare will be used to derive the keyshares for child accounts of the wallet. To create a keyshare you'll execute our descentralized key generation (DKG) protocol.
Once you have your wallet keyshare, you need to call the Create Keyshare endpoint to finish the creation of your keyshare. Dkg_id
will be a random UID, save this parameter for later use.
1.3 Create Wallet
If you are not interacting with alore from a client-side app, we strongly recommend the creation of a new user in the api key to be used as a wallet owner (and for everything else).
1.4 Link your keyshare
The last thing you got to do is link your generated keyshare (using dkgId
) with a given wallet. In this case, we are going to use the wallet_id
from the previous step.
2. Creating an Account
Accounts are responsible for receiving and sending assets. Each account has its own address and is related to a Wallet, with no limit on the number of accounts per Wallet.
2.1 Get your Wallet Keyshare
This will be necessary so you can derive a keyshare from your wallet to your account. In case you’ve lost this information, you can get it using this function:
2.2 Derivate your Wallet keyshare to create your account
Your account keyshare will be derived from your Wallet keyshare. To do so, use the retrieveDecryptedKeyshare
again:
2.3 Create Account
Now you can use the eth_address
from your account keyshare at the Create account endpoint. Ex: keyshare.eth_address
. Type will be ‘account’, to get your walletId
check the topics above.
3. Send
Let’s send! Setup your transaction, estimate your gas, and sign!
3.1 TX and setup
Get your TX and use the Setup Transaction endpoint, it allows users to initiate a transaction setup process on a specified Ethereum network. The transactionType parameter can be any of those four: Send
, SendERC20
, SendERC721
, and SendERC1155
.
3.2 Estimate gas
You can execute transactions without estimating gas fees, but it is probably going to cost you more than it should. The endpoint calculates the gas price based on the current state of the blockchain and returns the estimated fee in the user's preferred currency. We usually use 50 as the tip_percentages
.
3.3 Get your keyshare and sign
Now all you have to do is get your created account keyshare and sign. You have two options to sign: use the signing phase 1 to 4 or use the signTransaction
function which we strongly recommend and will save you time by automatically executing these endpoints.
3.4 Send the transaction
Now you can send! signedTxRlp
will be the response from the previous step.
Thanks! Feel free to contact us.