I am planning to create one smart contract but I am not able to grasp how to do it in Python flask, all I see about is how to do it in etherium.
I have already created one custom blockchain with:
Nodes - mine, add transaction, broadcast and more
BlockChain - for each nodes to maintain their local blocks
Wallet - Each node having wallet to maintain their amount
Transaction - To have transaction record in ordered way and having hash functions and more
But Right now I want to try to create one smart contract from scratch on my custom block chain but I am not sure how to do it. I am new in this field so any help on this ?
I just want to be able to use any one of the smart contract feature in my custom block chain without using etherium.
Related
I was working on a crud D-app, coding in solidity. I am unable to figure out how does deletion and updation work on the blockchain network?
There is none. You can only add new transactions. You have to add a new transaction saying something was deleted or updated, and then, whoever is displaying the data needs to see the new transaction and stop displaying the data.
If you are writing a smart contract, you can delete or update data in storage, but other people can still see that data since it's in the previous transactions - there is no privacy.
I want to get the "entire" ethereum blockchain data, not just from a few sets of smart contracts. By data I mean, transaction details including the generated logs.
I can get real-time data using Infura, but it's pretty much impossible to fetch all the old data, it would simply cost too much because I would simply have to do too many network requests.
I need the old data because I am trying to make an indexed database out of the "append-only" ethereum transaction data so that I can easily query it.
To be more precise, I would like to retrieve all NFT(ERC721, ERC1155) transfer transactions and their logs. So that I can do the following queries and much more: all the NFT owned by a particular wallet, transfer histories of a particular NFT token.
You can do this by
Run your own node
Query data from your node - locally it is fast
For some data, you might need to run the node in archival mode
You can use the same Web3 / JSON-RPC APIs on a local node than you are using on Infura.
Two solutions I have discovered.
Just like #Mikko has mentioned, you can run your own node. And it seemed not be as complex as I have expected. You can search for "geth" and then simply connect this node to your web3 library, just like connecting to Infura.
But I have not tried this and found a much better solution.
Google cloud Bigquery's public data set has all the old ethereum data. Bigquery is Google's data warehouse service, where you can use simple SQL to query your data. It adds new data every day. I have already tested some simple queries from its console and the result was good.
I am planning to fetch all the old data I need from bigquery and store it in my own database and afterwards get real time data from infura. Now that I dont have to fetch all the old data from infura, the price becomes very affordable.
you may check this https://github.com/blockchain-etl/ethereum-etl
It is a Python library for ETL (extract, transform and load) jobs for Ethereum blocks, transactions, ERC20 / ERC721 tokens, transfers, receipts, logs, contracts, and internal transactions.
For example, you may run the cli command
> ethereumetl export_token_transfers --start-block 0 --end-block 500000 \
--provider-uri file://$HOME/Library/Ethereum/geth.ipc --output token_transfers.csv
You may export ERC20 and ERC721 transfers by specific the block number which enable you to query the old data.
Data is also available in Google BigQuery.
How to get Ethereum internal transaction list / contract transaction list by RPC ?
Contract: 0xa5025faba6e70b84f74e9b1113e5f7f4e7f4859f
How to get the contract address transaction list by RPC ?
enter image description here
What you are trying to do is iterate through the blockchain and check each transaction in each block for a transaction that you are describing. While this will work (with a bit of code), you are better off reading the data from an existing block explorer. By doing it on your own, you will be creating a limited-functionality block explorer, when you should be using other resources.
Take a look at the Etherscan APIs, as they contain all the data you need.
I am working on a use case. The requirement being I need to create an order. The order has some customer parameters. The order can be modified multiple times. Initially, I thought of implementing it in Ethereum. So, I thought of capturing the customer details from a UI and store it on the smart contract. However, the issue is once the contract is deployed I cannot change it since it is immutable. This drawback prevents me to use Ethereum. Deliberating on Corda, can I store the customer data as a single records and make modifications to it such that modifications are stored on the ledger which we can query. For instance, I want to store customer ID, Customer name, customer purchase order number, order type, and order status.
How would I do that in Corda data model?
Will that data be modifiable based on the rules coded on smart contract?
The data can be queried?
Yes.
In Corda, you store information using States. In your case, you might create a CustomerDataState class. You'd then create instances of this class on the ledger to represent your various customers.
This data can then be updated using transactions. But not all transactions are allowed. Which transactions are valid is based on the rules in the associated CustomerDataContract. The CustomerDataContract will be stateless, and simply exists to say how CustomerDataStates can evolve over time.
You can then easily query this data from your node's vault or transaction storage using an SQL-style syntax.
I am trying to understand about registry, like what is registry, why do we need to store Assets and Chaincodes in registry, where does registry gets stored.
Firt of all, the chaincode (or smart contracts) and the assets are two different things.
Chaincode: the code that you will execute/invoke. This code is the same in all the nodes, i.e. each node of the network has installed the same chaincode.
Assets: you digitize the assets using transactions that are governed by smart contracts.
On the other hand, how it works:
Ledger: the Ledger stores all the transactions. The ledger is comprised of a blockchain (‘chain’) to store the immutable, sequenced record in blocks. Each peer maintains a copy of the ledger.
State Database: maintains the current state. It represents the latest values for all keys ever included in the chain transaction log. Chaincode invocations execute transactions against the current state data.