[ 3 / biz / cgl / ck / diy / fa / ic / jp / lit / sci / vr / vt ] [ index / top / reports ] [ become a patron ] [ status ]
2023-11: Warosu is now out of extended maintenance.

/biz/ - Business & Finance


View post   

File: 26 KB, 400x400, 1672440321154131.jpg [View same] [iqdb] [saucenao] [google]
54867910 No.54867910 [Reply] [Original]

any web3/crypto devs on here? i know basic programming but i dont understand how crypto can be used to store data. dumb example but if i wanted to make a fitness app that tracks your weightloss, would i be able to store yoru weight using transactions? and wouldnt this mean each transaction costs the user money? or like a text messaging app, wouldnt each tetx message cost a few dollars depending on the crypto used?

>> No.54867932

>>54867910
fuck your fitness app

>> No.54867995

>>54867910
You store data by turning it into 1s and 0s.

laymans example. You create a binary number to represent each letter 0000 is a 0001 is b 0010 is c 0011 is d etc.

So yes, you can store words and numbers in a blockchain. But you can also just store that data regularly. What about your fitness app requires a chain to be created? ideally you would want to use a polygon chain to save yourself on server costs in storing that data.

>> No.54868035

>>54867910
Hello retard.
>>54867995
This guy's basically right. Yes storing and transacting on a blockchain costs money.

Blockchains make sense when properties such as permissionless, tamper proof minimized transactions are what you want, and those properties are worth the cost of transacting on a chain. This is why there's a ton of value locked in things such as Uniswap and other decentralized exchanges.

>> No.54868088
File: 38 KB, 385x393, alien3.jpg [View same] [iqdb] [saucenao] [google]
54868088

>>54867995
>>54868035
im just trying to think of real, practical examples for using a block chain with an application. all i can think of is using it like a decentralized database but to save your data it would cost what ever the gas fee costs. if i wanted a text file to be accessed by multiple people from anywhere maybe i could put it on the block chain, but seems like to access or save the data would cost way too much to be useful

>> No.54868194

>>54868088
its good for money or uh.... I guess public contracts.


you could also theoretically use it for digital assets like swords for slaying pixel dragons

for pretty much everything else you should probably use a database.

>> No.54868233

>>54867910
I'm a dev in web3 but I will not spill the beans because I'm a gatekeeper like all my friends are in the web3 space. We use buzzwords to confuse people so the think we are smart, but in reality it's all gatekeeping. That's why this industry is not growing and never will. It's crabbing for ever and ever. Btw there are many dapps with your shitty idea already.

>> No.54868242

>>54868088
Lmao I know the answer. But again I'm a gatekeeper

>> No.54868319

>>54868194
every app that uses crypto is just a normal app with shitty nfts stapled on

>> No.54868345

>>54867910
>he fell for the meme that crypto is useful for making apps
Lmao

>> No.54868513

>>54867910
this is exactly what ICP was designed for...storing data on chains like ETH is impractical due to high costs

>> No.54868552

>>54868513
If you like ICP I suggest you also check out MySQL, its a little older but it hasn't rugged yet

>> No.54868674

>>54867910
are you familiar with state machines?
essentially any Ethereum contract can act as a state keeper.

on chain data retention is retarded though without a reason for data to remain immutable

>> No.54868715
File: 497 KB, 1280x1652, 1674551459771483.jpg [View same] [iqdb] [saucenao] [google]
54868715

pragma solidity ^0.8.4;

contract WeightTracker {
// Define a custom data structure to store user weight records
struct WeightRecord {
uint256 date;
uint256 weight;
}

// Mapping to store user's weight records
mapping(address => WeightRecord[]) private userWeightRecords;

// Event to emit when a new weight record is added
event WeightRecordAdded(address indexed user, uint256 date, uint256 weight);

/**
* @notice Add a new weight record for the caller.
* @param _date The date of the weight record (Unix timestamp).
* @param _weight The weight of the user in grams.
*/
function addWeightRecord(uint256 _date, uint256 _weight) external {
WeightRecord memory newRecord = WeightRecord(_date, _weight);
userWeightRecords[msg.sender].push(newRecord);
emit WeightRecordAdded(msg.sender, _date, _weight);
}

/**
* @notice Get the number of weight records for the caller.
* @return The number of weight records.
*/
function getWeightRecordCount() external view returns (uint256) {
return userWeightRecords[msg.sender].length;
}

/**
* @notice Get a specific weight record for the caller by index.
* @param _index The index of the weight record in the user's weight records array.
* @return The date and weight of the specified record.
*/
function getWeightRecordByIndex(uint256 _index) external view returns (uint256, uint256) {
require(_index < userWeightRecords[msg.sender].length, "Index out of bounds");
WeightRecord storage record = userWeightRecords[msg.sender][_index];
return (record.date, record.weight);
}
}

>> No.54868727

>>54868715
Good job with chat gpt

>> No.54868750
File: 2.55 MB, 2245x1054, 1674534595488334.jpg [View same] [iqdb] [saucenao] [google]
54868750

>>54868727
Using solidity. Write me a contract for a dapp that allows users to store and track their weight.

>> No.54868819

>>54868035
Some DLT solutions are feeless e.g. iota

>> No.54868888
File: 311 KB, 1546x1578, Screen Shot 2023-05-05 at 9.07.37 PM.png [View same] [iqdb] [saucenao] [google]
54868888

>>54867910
hi, here is an unironic answer for you:

The thing you want to google is how to use Structs in your contracts. A Struct is basically solidity's version of an object, and you could use one to store data about a given entity.

I built a racing web3 game that i tried to shill here last week and we'll be launching our token this weekend - here is how I represent races in my solidity contract using a struct - you can then use mappings to allow constant-time lookup of your objects by some key, like a GUID or something

>> No.54868897
File: 394 KB, 2046x1826, Screen Shot 2023-05-05 at 9.11.00 PM.png [View same] [iqdb] [saucenao] [google]
54868897

also, just do this