Sending USDTC to a new Tron address in testnet --"Unrecorded Token" - blockchain

I have a newly generated TRON address in testnet - Shasta. I'm trying to send USDC to it, from a faucet - usdcfaucet.com. While on an Ethereum testnet it'll get received fine, if I send it there, on TRON there's been ocurring an error
"Unrecorded Token"
And my balance has never increased.
What's the matter?
Does TRON require activatation, or explicit creation on a token account, perhaps?

Related

Transaction failing while transferring NFT on solana: Error processing Instruction 0: custom program error: 0x1

Error: Failed to send transaction: Transaction simulation failed: Error processing Instruction 0: custom program error: 0x1.
Getting this error when transferring the NFT token. After looking up the error code 0x1 from here, got to know that the error is due to insufficient funds in the sender account. But I have some 8 SOL which I guess should be enough for the transaction.
I am implementing the transfer NFT logic using the first answer over here
What am I missing here?
Any help is appreciated. Thanks in advance.
I can help more if you specify the code you wrote. But I guess the balance of the account you sent may be low (or zero), so you need to send NFT with fund-recipient.
If the receiver does not yet have an associated token account, the sender need to fund to create associated token account for receiver's solana account.
I usually create associated token account (here you need to create it for your NFT account for recipient) then transfer token or NFT
for python coding
token_pda_address = get_associated_token_address(sender_account, mint_account)
mint_account = get_associated_token_address(destination_account, mint_account)
associated_token_account = create_associated_token_account_instruction(
associated_token_account=mint_account,
payer=source_account.public_key, # signer
wallet_address=destination_account,
token_mint_address=mint_account,
)
spl_transfer = spl_transfer(
SPLTransferParams(
program_id=token_account,
source=token_pda_address,
dest=associated_token_account,
owner=sender_account,
signers=[],
amount=1,
)
in this example token_pda_address and associated_token_account must be the same type of account.

Is it possible to tell if a transaction involves an ERC721 token if the only information you have is the transaction address from Ethereum blockchain?

Right now I have a web socket that's subscribed to all pending transactions. I was wondering if I'm able to figure out if I'm able to decide if a particular transaction involves an ERC721 token with the object that gets returned.
I was looking into Etherscan recently and I realized that a lot of the data Etherscan displays seems pretty challenging to retrieve and was wondering how Etherscan's ERC721 token transfer feature is implemented.

Note: The called function should be payable if you send value and the value you send should be less than your current balance

I'm trying to use ERC20 implementation of openzeppelin, but getting an error. tokenAddress is an address of the existing ERC20 token, for example USDC - 0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48
import "https://github.com/OpenZeppelin/openzeppelin-contracts/blob/v3.4.0-solc-0.7/contracts/token/ERC20/ERC20.sol";
ERC20 token = ERC20(tokenAddress);
token.balanceOf(msg.sender);
An error
revert The transaction has been reverted to the initial state. Note:
The called function should be payable if you send value and the value
you send should be less than your current balance. Debug the
transaction to get more information.
The Remix VM emulator can't reach the contract deployed on the mainnet address - it's in a different environment.
However, you can fork the mainnet to your local environment, and then connect Remix to this local environment.
Here's an article describing how to fork the Ethereum mainnet using Ganache.
One-click solution based on the article:
ganache-cli --fork https://mainnet.infura.io/v3/{infura_project_id}
Then you can select a custom provider in your Remix IDE.
ganache-cli is listening on port 8545, and Ganache UI on 7545.
Enter the local "Web3 Provider Endpoint" address with the port number 8545 (ganache-cli) or 7545 (Ganache UI).

how to get test tokens on rinkeby and ropsten

I'm building some Wallet functionality for Ethereum ERC-20 Tokens. I just have a few questions:
Let's say I want to test an ERC-20 Token (BAT) for example. How can I send test BAT or AAVE or any other token to myself? I only have access to both Rinkeby and Ropsten and can't find a faucet for these, only Kovan.
Can I reuse the same generated Eth address for all ETH Tokens? Are there any gotcha's I've gotta think about?
Thanks
How can I send test BAT or AAVE or any other token to myself?
As far as I'm aware, there are no "official" BAT or AAVE token contract on the testnets. By official, I mean - supported by the original token authors or their team.
So you can do what some people before you did as well. Copy-paste the BAT token source code, and deploy it on the testnet. Only in this case, you modify the constructor or other functions to mint the tokens to your address, or to give you some kind of authorization (owner for example).
Or you can write and deploy a custom token contract. Either from scratch - or by extending the OpenZeppelin ERC-20.sol opensource implementation, you just call their constructor with your values.
pragma solidity ^0.8;
import "https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/token/ERC20/ERC20.sol";
import "https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/access/Ownable.sol";
contract MyToken is ERC20, Ownable {
// sets the token metadata such as name and symbol, also sets the `owner` to `msg.sender`
constructor() ERC20("MyToken", "MyT") {}
// effectively mints the `_amount` of new tokens to the `owner`
function mint(uint256 _amount) external onlyOwner {
_mint(msg.sender, _amount);
}
}
Can I reuse the same generated Eth address for all ETH Tokens?
The token balance of an address is stored on each token contract - not on the address alone. So there's no capacity limit of how many tokens can an address own, if that's your concern.
For some people it might be important to use separate address for each token for privacy reasons. If you separate the tokens that you own to multiple addresses, it's much harder to estimate how much you (as a person) own in total.
Another reason that some people use is redundancy. If you lose access to one of your addresses, you still have multiple others with balance.
How can I send test BAT or AAVE or any other token to myself?
On testnet, to get test tokens you can deploy the token contract yourself.
Deploy an ERC-2t0 token and you can call your token any name: AAVE, BAT or even MAGNA.
Can I reuse the same generated Eth address for all ETH Tokens? Are there any gotcha's I've gotta think about?
You can use a single Ethereum account for all tokens.

MetaMask RPC error? 'MetaMask - RPC Error: Internal JSON-RPC error.'

I'm developing the front-end to an application that I'm trying to test. However, MetaMask keeps giving me this error? I tried changing the gas limit like previously suggested and nothing. Any ideas?
Error:
MetaMask - RPC Error: Internal JSON-RPC error.
code: -32603
data: {code: -32000, message: "gas required exceeds allowance (30000000) or always failing transaction"}
message: "Internal JSON-RPC error."
Without seeing the code, it's hard to say for sure but you could try:
Check any code you changed in the front end, specifically in your code you may have something like this:
const contractInstance = new state.web3.eth.Contract(
MyContract.abi,
"0x.....", // contract address
{
from: state.accounts[0],
gasPrice: 1000,
gas: 100000
}
);
Make sure the gas prices are similar to those, you may have to adjust for your case.
Re-compile and redeploy --> for truffle, run truffle develop first, then compile then migrate --reset for local deployment.
In Metamask, reset your test account. Metamask > Select Account > Settings > Advanced > Reset account. Only do this for testing accounts
Previously it used to happen in older versions due to a gas specification issue which was fixed. rpcErrors.internal` expects a string as the first argument, with arbitrary data being the optional second argument. Passing in a non-
string first argument results in the error being shadowed by an error
from eth-json-rpc-errors.
Please check what you are passing to Metamask.
In my case, after trying so many options I have restarted Ganache and re-imported new account from Ganache to Metamask.
I connected this new account with localhost application.
This resoles my issue.
Before performing any transaction the sending ETH address must be connected to your own site or UI. So it can get the address of sending account and goes towards the further transaction in the metamask.
Make sure Your sending account address must be connected to your UI.