Hi I'm new to SOLANA Blockchain , While gazing through the charges inside Solana, I found there is a fee associated with transaction like , minting tokens , transferring them , creating token accounts etc.. But there is another charge called Rent that is associated with an account as per the size of the instructions we are storing. But I'm confused that which account this rent is associated to.I'm using
1 Payer Account as payer in transactions , minting etc..
This Payer Account is also the owner of the spl-token that I created
2 Token account that holds the tokens
3 Normal wallets which are used for sending / receiving / minting tokens
4 Smart contracts to execute more operations , \
So I have 4 accounts as said above , so from which account solana will be taking the rent from,Please help ..
Thanks in Advance.
Related
I am building a staking dapp where a user will get staking rewards after staking the custom ERC20 tokens for a specific period of time. In the contract I want to reward the users those who refers there friends into the staking website by providing a percentage of the amount staked by there referred person. The referral system will have five levels and rewards according to those levels.
The rewards are :-
Lvl 1 = 7% Referral deposit
Lvl 2 = 3% Referral deposit
Lvl 3 = 2% Referral deposit
Lvl 4 = 1% Referral deposit
Lvl 5 = 0.5% Referral deposit
For example - if someone joins through my referral then I become his/her Level 1 referrer and the person who referred me becomes the level 2 referrer and the person who referred the level 2 referrer becomes the level 3 referrer and this continues till level 5.
I am keeping a database and using an api in order to keep track of which address referred whom.
This is the format to send data to the database, the referrer field is optional.
{
"type": "register",
"address":"0x78910",
"referrer":"0x12345",
"coin":20
}
In the frontend I am keeping an input field where the users will put there referrer's address and that would go to the database and then the smart contract will make a call to the database through oracles and get all the addresses and there levels and then the contract will pay them accordingly.
My question is how can I make this happen?
I know using oracles is the way but I couldn't understand how to implement it in the code to make it work.
Can anyone help me??
Chailink AnyAPI allows you to fetch any data from off-chain API and write the data back to on-chain smart contract.
To use Chainlink AnyAPI, you should run a Chainlink node(you can find how to run a Chainlink node here) or rely on oracle nodes run by others(read more details here).
With the Chainlink node, you are able to deploy an oracle contract and monitor requests from the smart contract(your dApp). Request from your smart contract can trigger the Chainlink node to finish its job and write back data to the smart contract. In your dApp, the smart contract can send a request to your database and get the referrer info with Chainlink Any API.
A full tutorial can be found here.
I want to understand Solana rent and it's relation to the CLI usage. I understand the basics, that you need 2 years worth of rent in order to be rent-exempt but I have several questions in order to reach a better understanding:
I have wallet keypair keypair.json
I run:
solana account keypair.json
Balance: 2.95953572 SOL
Owner: 11111111111111111111111111111111
executable: false
Rent Epoch: 280
Should I assume that rent is 280 lamports per. Epoch? Do I need to calculate this based on how many epochs in two year to figure out what sol is required for rent exempt? Isn't there an easier way simply find out rent-exempt requirements if I have the keypair file or even just the public key of an account? Usage of "solana rent" command is confusing since I have no idea of the "data length" of my account.
When running the following commands in order to create different types of accounts can I always assume that enough Sol is automatically put into the account for it to be rent-exempt?
spl-token create-account
spl-token create-multisig
When creating a nonce account i'm required to specify the amount to put into the nonce account? If I'm using this nonce account temporarily for a multisig process how much SOL should I put in there?
solana create-nonce-account nonce-keypair.json 1
If you want to know how rent is calculated you can use the solana rent CLI command.
For example, any account in the system that is not a data account (i.e. has no data requirement) will display the rent exempt minimal fee:
solana rent 0
Rent per byte-year: 0.00000348 SOL
Rent per epoch: 0.000002439 SOL
Rent-exempt minimum: 0.00089088 SOL
For program data accounts (i.e. any account that is created to be owned by a program to read/write state to) will be a higher cost because of the storage needs. Let's assume your program stores a PublicKey (32 bytes) in an account, then rent for that account is calculated:
solana rent 32
Rent per byte-year: 0.00000348 SOL
Rent per epoch: 0.000003048 SOL
Rent-exempt minimum: 0.0011136 SOL
I'm using the square api sandbox to charge nonce and charge customer profile.
when I charge nonce all the card details : last four, card brand are included in the response except for the expiration date.
Tender[0].CardDetails.Card.ExpMonth and ExpYear is null
when I charge profile the same fields return data
is this going to be the case in production? is there a way to get this information?
The information will be a part of the Charge response if it was for a card on file (using customer_id and customer_card_id). If you just call Charge using a card_nonce rather than a card on file, then the information will not be surfaced.
i will appriciate any help with my problem, I created a script that basically takes a students list and starts to send invitations to different courses, at some point i am getting this error "Error: #UserInvitationQuotaExhausted The user does not have enough quota to invite users to this course."
I am using a domain account not a personal account, i have read that the invitations quota for personal accounts is 100 per day, but i can not find any information about domain accounts. Is there any form to increase the quota of invitations for my domain account?
Thank you.
Here's the Usage Limits
To view or change usage limits for your project, or to request an increase to your quota, do the following:
If you don't already have a billing account for your project, then create one.
Visit the Enabled APIs page of the API library in the API Console, and select an API from the list.
To view and change quota-related settings, select Quotas. To view usage statistics, select Usage
This also seems relevant.
Activity or feature
Google Workspace or school account
Personal Google Account
Teachers per class
20
20
Class members (teachers and students)
1,000
250
Classes you can join
1,000
100 maximum, 30 per day
Classes you can create
No limit
30 per day
Class-member invitations you can send
500 per day, per teacher
100 per day, per teacher
Guardians per student
20
Feature not available
Email address visibility
No limit
Feature not available
Topics per class
200
200
Classes you can select to simultaneously post an assignment, material, question, or announcement
20
20
Taken from https://support.google.com/edu/classroom/answer/7300976?hl=en (2022-04-14)
I have an app that uses Parse as its backend, and has Stripe integration. On Parse, I store a Stripe customer id on my User class, and I have a custom class that has a charge token associated with it, so that a customer can create a service request, and when a provider accepts and fulfills that request, they can have the charge be sent to their recipient id.
A user could cancel the service request, or a provider could show up to the user's property and find that the property is unserviceable for various reasons. In this event, we have a cancellation fee that the users are charged.
I want to make sure that if the cancellation fee is charged, it gets charged to the same card that the user used to request the service. I noticed that when I fetch all of the cards from a customer id, they always show up in the same order, but when I add a card, it doesn't always add it to the end of the array that gets returned when I fetch cards. So, if I just stored the index of the card, a user could add a new card, and it would possibly take the place of the one that was being charged for the service. If I charged a card based on the index for a cancellation, it could charge the incorrect card. Would it be PCI compliant to store the cardID used to create the charge token on the Parse object that contains information about the service, so when I call my functions to create cancellation charges, I'm charging the same card?
Thanks for anyone who can provide some information on this.
The only sensitive data that you want to avoid handling is your customers' credit card number and CVC; other than that, you're welcome to store any other information on your local machines.
As a good rule, you can store anything returned by our API. In particular, you would not have any issues storing the last four digits of your customer's card number or the expiration date for easy reference.
from: https://support.stripe.com/questions/what-information-can-i-safely-store-about-my-users-payment-information