2

For 1 you may use web3.eth.getCode(address) function of Web3 API. For contract addresses it returns contract byte code, while for non-contract addresses it returns something like "0x". For 3 it depends on what "public" means for you. If you mean whether smart contract has verified source code published at Etherscan.io, then you may use either API call to ...


2

It is unclear what layer you want to find out this information on (on-chain or off-chain). In general: Is an address a smart contract? This can be checked by seeing if there is associated code at the address. Is this smart contract ERC20 or ERC721 token? Off-chain, you can check this by observing the contract on Etherscan. There are also interfaces ...


2

It's not so much about whether a smart contract has a private key or not; it's more about the fact that smart contracts can't initiate a transaction. All transactions are started by an EOA to either a smart contract or to another EOA. If a transaction is sent to a contract the contract may include functionality to call another address within the same ...


1

The smart contract can only send a transaction to an EOA if the transaction was initiated by an EOA. Smart contracts cannot initiate a transaction because they do not have a private key and cannot sign a transaction, as you said. When value is being sent from a smart contract to an EOA, what is really happening is an EOA sending a transaction to the network ...


1

You can simply check val as a uint. Your code would look as follows: function airdrop(uint val) public payable { require(airdrop == true); if (val == 1){ msg.sender.transfer(1 ether); airdrop = false; } }


1

Only an EOA can sign and send a transaction. It can be addressed to a contract in which case the contracts functions must run. A contract's functions can send messages and/or value to other contracts in which case they also run, or to an EOA which just receives because it has no code. All of this happens approximately instantaneously (after mining) ...


Only top voted, non community-wiki answers of a minimum length are eligible