New answers tagged

0

You can use assembly language to access the byte code of the smart contract that you've just deployed within your smart contract. See the simplified example below for details. Using remix, you can deploy the factory, and then call register and it will emit an event with the byte code of the smart contract you just deployed. Based on your example - you could ...


1

We solved this by having a one time init function. For full source, see ThingFactory.sol and Thing.sol. Basically, what you do is have this one time init function on your target contract (in the example, it would be Thing.) Then your factory contract calls the init function directly after creating the clone. The ...


0

it's an old trend i hope you have solution, but if someone has the same question let me say that you are missing assign values to owner here: address public owner; // contract owner you need do it:  address public owner = msg.sender; you can do it in the same line or into a constructor :) and delete this function that you created: /// Set owner ...


2

You use the transaction's hash to obtain the transaction's receipt, if you made a single call to createCourt you have a single event in the receipt. Another option is to accept an random input parameter and use that as id.


0

You can add second parameter to your event: event CourtCreated(address indexed _address, uint256 _id); And later on execute the event in your methods like this: emit CourtCreated(msg.sender, _id); Now with the keyword indexed before _address parameter with web3.js you can filter the events by the address. You can check which events are executed by you ...


0

You will need to implement a smart contract using something like Solidity. Please take a look at this if you would like a fairly easy way to learn the basics of Solidity: https://cryptozombies.io/ If the language itself allows you to properly handle and store the types of data in the ways that you need to, we would need to establish whether or not Ethereum ...


0

Please see my comment for suggestions to get a more informative answer. How to save the output in a blockchain (on-chain) through transactions? You pass a signed transaction to a function that is designed to receive the data (arguments) and you store the values in contract state variables. How to include the On-chain blockchain in all this through ...


0

If your goal is to have persistent certification data storage on the blockchain, and retrieve the same, you can make use of setter and getter methods. Solidity creates a getter method for public state variables by default. In case of private state variables, you need to define a getter method to read the stored value.


1

You can see the "25" in the state change tab (switch to 'number'). But the easiest is probably to make the contract emit an event, as it is easy to read all events of contract from web3.


1

Change this: await contract.methods.transferOwnership(targetOwnerAddr).call({from: ownerAddr}); To this: await contract.methods.transferOwnership(targetOwnerAddr).send({from: ownerAddr}); And of course, you'll need to make sure that account ownerAddr is unlocked on the node that you're communicating with... Please read some more about call and send.


0

It is not true that the limit is 1.46GB. A smart contract can theoretically store 2^256 words of 32 bytes. That is a ridiculously huge amount of data. The amount of data used by a smart contract that implements a token (ERC20) is really small. The amount of storage needed to register tokens of 200 Million users is 200 Million words of 32 bytes, which is ...


0

The resulting contract owner, if the contract does not assign his own ownership explicitly to someone, is the EOA who paid the gas for the deployment. This does not mean that he is enabled to modify the contract or to kill it or whatever, because possible code details. In particular the originator of the contract can/must store this property at deploy time ...


1

The smart contract environment is not adequate to implement any machine learning algorithm which could need a non definite number of iterations. This aspect conflicts with the maximum computational power which can be included in a single Ethereum block, where you cannot split the convergency algorithm to use more blocks than one without heavy overheads. On ...


0

No, you can't. Only the node that receive the transaction could know it, but once the transaction is spread to the others nodes, this is hopefully lost.


2

I do not think it is possible. At least, it cannot be found in the documentation: https://solidity.readthedocs.io/en/v0.6.1/miscellaneous.html#index-4 Moreover, it would be a major paradox into a blockchain (at least a public one). One nice element is that it is very hard to know who is who in a network unless you want people to know it. If you have access ...


1

The yellowpaper (version 7e819ec - 2019-10-20) section 6.1 Substate includes a description of: indexable ‘checkpoints’ in VM code execution that allow for contract-calls to be easily tracked byonlookers external to the Ethereum world (such as decentralised application front-ends). The yellowpaper preceded the event terminology, but an event is a way ...


1

Here are my thoughts on this topic: Don't store your private key or mnemonic on your machine if it is connected to the internet. This is a great target for hackers. Over the years I have seen many different approaches. For example: Hardware Wallets Paper Wallets However a cheaper option is storing the private key as an encrypted (password protected) text ...


0

You dont have any ropsten ETH. You need enough Ropsten ETH in your accout to cover the gas costs of the transaction. You can get some from here :https://faucet.ropsten.be/


0

YES! We've just shipped it here. P.S. It covers Vyper too.


1

You've declared function misbehaviorJudge. But you've implemented function misbeaviorJudge. So the way I see it, you are trying to invoke an unimplemented function. A couple of ways for you to avoid a similar issue next time (more precisely, convert it from a hard-to-investigate runtime problem into an easy-to-investigate compilation problem): Option #1 -...


3

Etherscan is the most cut-and-dry, but there are at least a couple of other resources available: SmartContract.Codes - a p2p search engine for smart contract source code. ethPM - a decentralized package manager used to distribute EVM smart contracts and projects. I'm a big fan of ethPM, but it can take a bit of time to understand. Here are a few more links ...


2

Yes. Nodes and transactions (deployment of a contract is just a transaction) are two completely separate things. If the node has an RPC interface opened and it allows you to send requests with a method named eth_sendrawtransaction, then you can forge your contract data and send it to the network through this node. No need to have your account key handled by ...


0

Using pragma experimental ABIEncoderV2 you can return a struct and read it via web3js. Here is a simple example contract: pragma solidity ^0.5.12; pragma experimental ABIEncoderV2; contract Example { struct Store { string id; uint time; } mapping (string => Store) public purchases; function set(...


1

Contract deployment costs gas, so in order to deploy contract one usually has to have externally owner account with non-zero ether balance. However, you may create backend that will accept contract deployment transaction from a user via RPC even if origin address of the transaction does not have any ether on balance. After accepting such transaction, the ...


1

Please try this. You need to define get methods inside your anotherContract. This way I was able to create new anotherContract with method newContracts and later later it data with method getContractData. pragma solidity ^0.4.8; contract myFirstContract { address[] public childContracts; uint public idd; string public name1; function ...


1

Any data, smart contract manipulates with inside on-chain transactions, should be considered public. This includes contract initialization byte code, constructor paramerters, contract deployed byte code, any parameters passed to contract in on-chain transactions, and any data returned by the contract in such transactions. Also any data that ever appeared ...


Top 50 recent answers are included