Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save petrosDemetrakopoulos/4aae442b98c8e01b6eb1330d98047574 to your computer and use it in GitHub Desktop.
Save petrosDemetrakopoulos/4aae442b98c8e01b6eb1330d98047574 to your computer and use it in GitHub Desktop.
EthairBalloons Python Example
from ethairballoons.ethairballoons import ethairBalloons
prov = ethairBalloons('127.0.0.1', '..')
carSchema = prov.createSchema(modelDefinition={
'name': "Car",
'contractName': "carsContract",
'properties': [{
'name': "model",
'type': "bytes32",
'primaryKey': True
},
{
'name': "engine",
'type': "bytes32",
},
{
'name': "cylinders",
'type': "uint"
}
]
})
carSchema.deploy()
receipt = carSchema.save({
'model': 'A4',
'engine': 'V8',
'cylinders': '8'
})
print(receipt)
print(carSchema.find())
print(carSchema.findById('A567'))
print(carSchema.updateById('A4', {'model': 'A4',
'engine': 'V18',
'cylinders': '18'}))
print(carSchema.find())
print(carSchema.deleteById('A4'))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment