8
votes
Accepted
What is the best way to create own token in substrate?
You have several options to launch your own token on Substrate:
Using the Contract pallet to implement a token, take a look at this ERC20 token tutorial
With the balances pallet
Using the EVM pallet ...
7
votes
Accepted
Can't get transaction hash from signAndSend of Polkadot.js
The txhash is only returned when you use the non-subscribe form.
In code for the non-sub form -
// don't subscribe, txhash is returned
const txHash = await polkadot.tx.balances
.transfer('5F1pZe........
5
votes
Accepted
Finding about native token of a parachain
You have this information in the chain-spec of the network, if you want to query it, you can use RPC queries for it.
Specifically the system_properties RPC call
You can query it using CURL:
curl -H &...
5
votes
Accepted
About the total mint token in polkadot and kusama
You could query the total issuance at different block heights/hash.
Then compare the results.
But this will ignore the burned tokens if you don't mind.
5
votes
What is the best way to create own token in substrate?
The pallet-balance that comes preconfigured with https://github.com/substrate-developer-hub/substrate-node-template is the way to go.
4
votes
Accepted
How to create dex pallet?
Adam Wierzbicki has created just this. It is based on Uniswap V1. You can find his pallet here: https://github.com/Wiezzel/substrate-dex.
The pallet is not production ready, but is very useful for ...
4
votes
Accepted
How to send specific token (like ACA) using Polkadot.js
From what I understand from your question, if you just need to send a token between two accounts using polkadot.js you should check the corresponding Substrate runtime calls exposed by the API. In ...
3
votes
Accepted
How to retrieve number of decimals for custom token (not DOT)?
You can query the asset metadata like this:
let asset = await api.query.assets.metadata(0 /* Asset Id */);
console.log("Asset has", asset.decimals, "decimals");
3
votes
Accepted
Assets pallet token and democracy pallet
It's not possible right now, but will be after there's a fungibles::Lockable implementation for Assets (https://github.com/paritytech/substrate/issues/11446)
3
votes
Accepted
How to transfer a native chain token from one account to the contract?
Your pseudo-code is right. The user can call the method deposit of the contract and pass some value from the UI or the TS/JS code.
Also, other contracts can do cross-contract calls to you(they need to ...
3
votes
How can I query how many decimal places does a Substrate asset have?
The system_properties RPC call returns the on-chain properties for the connected chain.
Additionally, if using the JS API, it is also extracted and available on api.registry.chainDecimals, api....
3
votes
How to get the token balance(rmrk) by py-substrate?
from substrateinterface import SubstrateInterface
ASSET_ID = 8 # RMRK.app
ACCOUNT = '<<YOUR_ACCOUNT>>'
substrate = SubstrateInterface(url='wss://statemine-rpc.polkadot.io')
account_info ...
3
votes
Subsocial tokens to create profile
At the moment it's not possible, but they're working on it.
Take a look at their FAQ: https://docs.subsocial.network/docs/faq/overview#how-can-i-buy-subsocial-tokens
2
votes
Accepted
Slashing and rewarding funds
There seems to be no difference here. You can probably simplify the code to:
//slash fund
let imbalance = T::Currency::slash_reserved(&to_punish, collateral).0;
T::Slash::on_unbalanced(...
2
votes
How can I query how many decimal places does a Substrate asset have?
for native asset like DOT in polkadot is defined in chain spec and you can check here https://polkadot.js.org/apps/?rpc=wss%3A%2F%2Fpolkadot.api.onfinality.io%2Fpublic-ws#/settings/metadata
for ...
2
votes
Accepted
Mint Fungible Token Development Network
substrate-contracts-node is a template project for smart contract only, for token test you need to add Asset and Nft pallet into runtime like cumulus
2
votes
Accepted
Error while adding orml_tokens. 'Orml_tokens` does not have the std feature enabled
Any pallets that are added to the runtime needs to be no_std enabled
Have a look at how we(or any other chain) implemented it
Check your Cargo file and make sure you configured it correctly
2
votes
Accepted
What is the Token Standard used by the balances pallet to issue the native token for the chain in the substrate kitchen sink node?
I don't think any external 'token standard' is applicable here. If you would like to know what kind of operations are supported you can look at the traits implemented by balances pallet: Currency, ...
2
votes
Custom emitting, minting, and max total supply
For minting logic in Substrate you can use the fungible trait:
https://paritytech.github.io/substrate/master/frame_support/traits/tokens/fungible
For example, you could use mint_into trait to mint:
...
2
votes
Accepted
Initial Token mint in Substrate Blockchain
An initial mint map can be setup in the GenesisConfig. You can configure the initial balances of any number of accounts in there.
Minting can be done only by root via force_set_balance; this call ...
2
votes
How to call PSP22::approve function from Frontend
The way I approach such error is in 2 steps.
Make sure contract works.
Use Contracts-UI, deploy the contract and check that approve/allowance work as you expected.
Dry-run Tx
Before sending Tx, ...
2
votes
How to locked token in chain?
The most common way:
// pallet_x/src/lib.rs
pub trait Config {
Currency: frame_support::traits::LockableCurrency;
}
fn lock<T: Config>() {
T::Currency::set_lock(..);
}
And if you make the ...
1
vote
How to call PSP22::approve function from Frontend
it looks like you're not using await, you can also check how we've implemented it in the typechain-polkadot
1
vote
Add a logo to Substrate Native Token
You have to make a PR to Polkadot-JS apps to be able to set your custom logo among other things.
Here's an example : https://github.com/polkadot-js/apps/pull/6890
1
vote
Add a logo to Substrate Native Token
Substrate doesn't provide this feature natively.
I believe they just put these in their repository for third-party usage.
1
vote
PSP22 cross-contract call to get metadata such as token decimals and token name using ink!
Ink has a great example in the repo's examples folder called the Delegator
Its 4 contracts that all work together. The delegator even instantiates the other contracts then calls them later. Looks ...
1
vote
Accepted
PSP22 cross-contract call to get metadata such as token decimals and token name using ink!
You can find an example of using the *Ref pattern to call another contract, given its AccountId in this Bulletin Board example link from Aleph Zero network.
1
vote
Finding about native token of a parachain
You can also use Sidecar's endpoint runtime/spec.
So you would need to :
Install Sidecar locally
Add an .env file that points to one of Moonbeam's public endpoints, e.g. wss://moonbeam.api.onfinality....
1
vote
Runtime panic when teleporting dot from relay to parachain locally
The code that's panicking is this:
// After hashing each message in the message queue chain submitted by the collator, we
// should arrive to the MQC head provided by the relay chain.
...
1
vote
Need help with understanding Token Economics Design for Substrate based blockchain (without any Parachains)
I think you may need to rewrite this question to make it more specific and focused on one point.
It seems you are mixing to two things here:
The token economics of a Substrate based blockchain, which ...
Only top scored, non community-wiki answers of a minimum length are eligible
Related Tags
token × 33polkadot-js × 5
balances × 4
ink × 4
pallet × 3
parachain × 3
substrate-node-template × 3
assets × 3
transfer × 3
smart-contract × 2
orml × 2
bridge × 2
openbrush × 2
polkadot × 1
runtime × 1
kusama × 1
xcm × 1
python × 1
staking × 1
rust × 1
rpc × 1
chainspec × 1
transactions × 1
evm × 1
wasm × 1