I want to create smart contract which can upload and download file from blockchain. Is that possible? If so, how?
-
What exactly are you trying to achieve? Store data and retrieve it later? Download the whole blockchain in a contract? – axic Mar 10 '16 at 16:04
So files, in the traditional sense that I assume you are talking about when you use the word "files", are not stored on the blockchain; data is. All data is stored in HEX format and the more data there is, the more gas it needs to run. For this reason it's not really efficient or cost-effective to store "files" on the blockchain.
Instead, it's recommended to store files via IPFS or another decentralized / p2p / etc. system. If you want to learn more about referencing data stored in one contract from another contract, please check out the following:
Interactions Between Contracts
and the followup question:
"All data is stored in HEX format and the more data there is, the more gas it needs to run. For this reason it's not really efficient or cost-effective to store "files" on the blockchain."
And what about a sort kind of business of publishing docs in blockchain to obtain tokens for any view/download? Any contract around?
-
-
I've questioned to a statement and not to the original question. I think the answer could be useful even to the original question considering that nothing is specified in it about the nature public or private of the files. @NicolasMassart – Symb932 Mar 15 '17 at 16:34
-
Welcome to Ethereum! If you have another question, please ask it by clicking the Ask Question button. – Afr Mar 15 '17 at 18:19
-
Oh sure!! In the hope not to receive so much smoke as answers! ;-) @5chdn – Symb932 Mar 16 '17 at 6:07